property Command.Checked as Boolean

Retrieves or sets a value that indicates if the item menu is checked or unchecked.

TypeDescription
Boolean A boolean expression that indicates if the item menu is checked or unchecked.

Use the Checked property to check or uncheck a menu identifier. Use the Command property of the control to get a Command object based on the item's identifier. The following sample shows how to check/uncheck an item:

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (Button = 2) Then
        ' Adds a new item to menu with the identifier 1234
        Dim it As Item
        Set it = PopupMenu1.Items.Item("Auto saving")
        If it Is Nothing Then Set it = PopupMenu1.Items.Add("Auto saving", Default, 1234)
        ' Displays the context menu
        Dim nID As Long
        nID = PopupMenu1.ShowAtCursor
        ' Checks or unchecks the item
        If nID = 1234 Then
            it.Check = Not it.Check
        End If
    End If
End Sub