My most recent project has been to develop a Windows Forms Application that connections to Microsoft Dynamics NAV system. I have been working closely with a NAV specialist who has been exposing some web services I can then use to develop the application.
The application has to be able to perform a variety of tasks and operations so I have separated these out into different tabs to make the interface more intuitive and less cluttered. My problem came when I needed to get a users to select an item from a drop down list when they clicked on a submit button. Normally I could add a panel and then hide this until the user pressed the button but given the amount of information on some forms I decided this would not be a good idea.
My next thought was it would be nice if I could re-use the MessageBox functionality and add a drop down list on this but after some research online I soon learned that this was not possible. I did find some posts about creating a class based on the MessageBox functionality and extending this but that seemed like a waste of time and effort.
I then spent some time researching other options and was surprised to learn how easy it is to call another Windows Forms Application in an already running Windows Forms Application and get some data from it, see example code below.
In my new Windows Forms Application I then have the required functionality/display and two buttons. One button confirms the users selection and the other is for cancelling out of the interface. I have included the code below to return out of the new Windows Forms Application.