C
Claudio111
Guest
Hi all
I need to add dynamically Sub items to a MenuStrip Item (here CmdFiltra) getting the name from Datagridview Column Headertext and then Handle the click for each Sub Item
I'm using this code
Public Sub AddCmdFiltraItems()
For i = 0 To DGV.Columns.Count - 1
If i > 1 Then
Dim name As String = DGV.Columns(i).HeaderText
Dim item As New ToolStripMenuItem(name)
CmdFiltra.DropDownItems.Add(item)
AddHandler item.Click, AddressOf FiltraItemClicked
End If
Next
End Sub
Private Sub FiltraItemClicked(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show(sender.ToString)
MessageBox.Show("Clicked")
End Sub
I start to add sub Items from column 1
Now in the click Handler I need to Know the column Index corrisponding to the name of sub Item.
How can I find it ?
Continue reading...
I need to add dynamically Sub items to a MenuStrip Item (here CmdFiltra) getting the name from Datagridview Column Headertext and then Handle the click for each Sub Item
I'm using this code
Public Sub AddCmdFiltraItems()
For i = 0 To DGV.Columns.Count - 1
If i > 1 Then
Dim name As String = DGV.Columns(i).HeaderText
Dim item As New ToolStripMenuItem(name)
CmdFiltra.DropDownItems.Add(item)
AddHandler item.Click, AddressOf FiltraItemClicked
End If
Next
End Sub
Private Sub FiltraItemClicked(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show(sender.ToString)
MessageBox.Show("Clicked")
End Sub
I start to add sub Items from column 1
Now in the click Handler I need to Know the column Index corrisponding to the name of sub Item.
How can I find it ?
Continue reading...