Click here to Skip to main content
15,900,646 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have created one vb.net application. In this app, I have created dynamic menu
But the problem is how to call particular form on click of that menu.

Please Help Me..

Thanks In Advance.
Posted

1 solution

Your question is not clear.
But here is a solution that might just answer your question.

I am assuming you add some buttons to some menu.
Here is some pseudo code that might work.
VB
Public Sub AddButtonToMenu(ByVal menu As Menu)

   menu.Buttons.Add(New Button("Button 1"))
   menu.Buttons.Add(New Button("Button 2"))
   menu.Buttons.Add(New Button("Button 3"))

   For Each btn As Button In menu.Buttons
      AddHandler btn.Click, AddressOf btn_Click
   Next

End sub

Private Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
   Dim btn As Button = DirectCast(sender, Button)

   If btn.Text = "Button 1" Then
   ' Do stuff when a button is clicked here.
   End If
   ' Etc.
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900