G
Guest
I have a table (about 50 rows that populate the variables shown below in
lines 1 and 2) of shortcuts that I would like to read into a Windows Form.
The following code would work with one big exception:
CType will not convert a string to a MenuItem. (Line 3)
Dim MyShortCut As Integer = 13122 '13122 is integer for Ctrl2
Dim MyMenuItem As String = "MenuItem12"
Dim oMnu As Windows.Forms.MenuItem = CType(MyMenuItem,
Windows.Forms.MenuItem)
Dim oSC As Windows.Forms.Shortcut = CType(MyShortCut,
Windows.Forms.Shortcut)
oMnu.Shortcut = oSC
Is there a way to read and dynamically set this property from a table using
a different approach?
lines 1 and 2) of shortcuts that I would like to read into a Windows Form.
The following code would work with one big exception:
CType will not convert a string to a MenuItem. (Line 3)
Dim MyShortCut As Integer = 13122 '13122 is integer for Ctrl2
Dim MyMenuItem As String = "MenuItem12"
Dim oMnu As Windows.Forms.MenuItem = CType(MyMenuItem,
Windows.Forms.MenuItem)
Dim oSC As Windows.Forms.Shortcut = CType(MyShortCut,
Windows.Forms.Shortcut)
oMnu.Shortcut = oSC
Is there a way to read and dynamically set this property from a table using
a different approach?