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.M enuItem = CType(MyMenuIte m,
Windows.Forms.M enuItem)
Dim oSC As Windows.Forms.S hortcut = CType(MyShortCu t,
Windows.Forms.S hortcut)
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.M enuItem = CType(MyMenuIte m,
Windows.Forms.M enuItem)
Dim oSC As Windows.Forms.S hortcut = CType(MyShortCu t,
Windows.Forms.S hortcut)
oMnu.Shortcut = oSC
Is there a way to read and dynamically set this property from a table using
a different approach?
Comment