DesktopMenuItem Shortcut Syntax Error

I am working on a desktop project for Windows. I am trying to assign a shortcut key to a DesktopMenuItem on a drop-down menu for a Toolbar Button. I am getting a syntax error for the line with the property assignment for the following code:

// Create a drop-down menu for Help Toolbar Button
Var HelpButtonMenu As New DesktopMenuItem
HelpButtonMenu.AddMenu(New DesktopMenuItem("Help Manual"))
HelpButtonMenu.AddMenu(New DesktopMenuItem("Help With This Page").Shortcut = "F1")
HelpButtonMenu.AddMenu(New DesktopMenuItem("About"))

// Assign the new menu to the toolitem..
MainToolBar.tiHelp.Menu = HelpButtonMenu

Any help would be greatly appreciated.

Try storing that one in a new variable, assign the shortcut on the next line, then use the variable to add it to the menu?

Right, as Julian said, this line is the problem:

HelpButtonMenu.AddMenu(New DesktopMenuItem(“Help With This Page”).Shortcut = “F1”)

You can’t set properties directly on classes in the same line that you instantiate them. You’ll need to do something like this instead:

Var mnu as New DesktopMenuItem("Help With This Page")
mnu.Shortcut = "F1"

Greg O and JulianS. That works!! Thank you so much!!