P
PetterL
I writing a program where I read menu items from a file. But I have problem
when I click an menu item i want it to mark that one as checked but I cant
access the menu object of that item to see witch object was selected.
This is the sub procedure that read the items from an Array and create the
menutitem. The array hold more information to use in program when one of the
items is selected.
Dim finisharray(,) As String ' is set up under the form sub.
Dim FilRow() As String
Dim n As Integer
For n = 0 To 5
FilRow = Split(finisharray(n, 1), "=")
If FilRow(0) = "" Then Exit For
Dim windowMenu As ToolStripMenuItem = MenuStrip1.Items(1)
Dim windowNewMenu As New ToolStripMenuItem(Trim(FilRow(1)), Nothing, New
EventHandler(AddressOf windowNewMenu_Click))
windowMenu.DropDownItems.Add(windowNewMenu)
CType(windowMenu.DropDown, ToolStripDropDownMenu).ShowImageMargin = False
CType(windowMenu.DropDown, ToolStripDropDownMenu).ShowCheckMargin = True
If My.Settings.SelFlash <> "" Then
If My.Settings.SelFlash = LCase(Trim(FilRow(1))) Then
windowNewMenu.Checked = True
End If
Else
My.Settings.SelFlash = LCase(Trim(FilRow(1)))
windowNewMenu.Checked = True
End If
Next
when I click an menu item i want it to mark that one as checked but I cant
access the menu object of that item to see witch object was selected.
This is the sub procedure that read the items from an Array and create the
menutitem. The array hold more information to use in program when one of the
items is selected.
Dim finisharray(,) As String ' is set up under the form sub.
Dim FilRow() As String
Dim n As Integer
For n = 0 To 5
FilRow = Split(finisharray(n, 1), "=")
If FilRow(0) = "" Then Exit For
Dim windowMenu As ToolStripMenuItem = MenuStrip1.Items(1)
Dim windowNewMenu As New ToolStripMenuItem(Trim(FilRow(1)), Nothing, New
EventHandler(AddressOf windowNewMenu_Click))
windowMenu.DropDownItems.Add(windowNewMenu)
CType(windowMenu.DropDown, ToolStripDropDownMenu).ShowImageMargin = False
CType(windowMenu.DropDown, ToolStripDropDownMenu).ShowCheckMargin = True
If My.Settings.SelFlash <> "" Then
If My.Settings.SelFlash = LCase(Trim(FilRow(1))) Then
windowNewMenu.Checked = True
End If
Else
My.Settings.SelFlash = LCase(Trim(FilRow(1)))
windowNewMenu.Checked = True
End If
Next