handler problem

Joined
May 9, 2006
Messages
4
Reaction score
0
Hi, i create a menu from a database using datareader
then i 'm adding a handler for click event.
now iwant inside the handler procedure to get the text of the menuitem who called the handler and that's exactly my problem.
this is my code

Public Sub devsubmenu()
Dim cmddev As New OleDbCommand("Select modelname from devicetbl",OleDbConnection1)
OleDbConnection1.Open()
Dim dtread As OleDbDataReader = cmddev.ExecuteReader()
devmnu.MenuItems.Clear()
Do While dtread.Read
Dim ChildMenu As New MenuItem
ChildMenu.Text = dtread.Item("modelname").ToString()
AddHandler ChildMenu.Click, AddressOf model_click
devmnu.MenuItems.Add(ChildMenu)
Loop
OleDbConnection1.Close()
End Sub


End Sub
Private Sub model_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
' HERE I WANT TO TAKE THE MENUITEM (SENDER) TEXT AND PUT IT IN A TEXT BOX
End Sub


any ideas ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top