i have no idea how to use the checked function on menus, the code is my major query, how do assign code to something if it is checked or not!
thanks!
Printable View
i have no idea how to use the checked function on menus, the code is my major query, how do assign code to something if it is checked or not!
thanks!
Eh?
The Checked property is a Boolean value (True or False).
Supposing your menu item is called mnuChecker:
To programatically check it yourself:Code:mnuChecker.Checked = True 'when the tick is present
mnuChecker.Checked = False 'when it isn't.
To toggle:Code:mnuChecker.Checked = True
Hope that helps, if not submit some more info (in English).Code:mnuChecker.Checked = Not mnuChecker.Checked
Toot
Here's an example
Code:Select Case mnuMyMenu.Checked
Case True
mnuMyMenu.Checked = False
' Do something (or nothing) based on the fact that it's not checked
Case False
mnuMyMenu.Checked = True
' Do somthing because it's checked
End Select
This is just to tell you if the menu is checked. It is useful for having options in a program.Code:If mnumymenu.checked = True Then
Msgbox "The menu is checked."
Else
Msgbox "The menu is not checked."
End If
And if you want someone to click the menu and want it to be checked or unchecked:
Code:If mnumymenu.Checked = True Then 'If checked=True Then
mnumymenu.Checked = False 'checked=False
'do what you want if it is unchecked
ElseIf mnumymenu.Checked = False Then 'If checked=False Then
mnumymenu.Checked = True 'checked=True
'do what you want if it is checked
End If