8

I have a windows form application where I show information about products and product categories in a datagridview. I would like to create a popup window so when I right click on a product and choose add to category a popup window appears and in that I show all the categories in a dropdownbox and when I click a button the product add to the category.

I want to create a popup window with a dropdownbox and a button. How do I do that in a window form application?

C.Evenhuis
  • 25,996
  • 2
  • 58
  • 72
Erik
  • 225
  • 2
  • 5
  • 7
  • 2
    2 options IMHO: [ContextMenuStrip](http://msdn.microsoft.com/en-us/library/aszetbbk.aspx) or a custom Popup ([example here](http://stackoverflow.com/questions/3171640/dropdown-menu-with-scrollbar-in-net/3172041#3172041)) – digEmAll Apr 10 '11 at 09:50

3 Answers3

8

You can create a regular form, and call the myPopupForm.ShowDialog() method. The ShowDialog method blocks the main form, so the user can select a category, upon which you Close() the popup window; execution will continue on the main form.

More information can be found on http://msdn.microsoft.com/en-us/library/c7ykbedk.aspx#Y800.

C.Evenhuis
  • 25,996
  • 2
  • 58
  • 72
1
Form2 form = new Form2();

This method will be like the Message.Show method, but you can add Buttons, TextBoxes, etc. in the Designer tools.

form.ShowDialog();

This method will just bring up another form.

form.Show();
MarredCheese
  • 17,541
  • 8
  • 92
  • 91
Quantum
  • 379
  • 3
  • 12
0

AddHandler Me.Click,AddressOf Me_Click

Private Sub Me_Click(ByVal sender As Object, ByVal e As EventArgs)
   Dim popupForm As PopupForm = New PopupForm()
   popupForm.Show(Me)
End Sub

You may get an exception window.Click continue-popup window will come.For further clicks get as many popups as you click Regards kvinvisibleguy