Results 1 to 6 of 6

Thread: RESOLVED: want my checkbox to uncheck when context menu appears

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    121

    RESOLVED: want my checkbox to uncheck when context menu appears

    when my context menu (which comes up when right-clicking on my checkbox) pops up, i want the checkbox to be unchecked. so i have this code for my context menu:

    Code:
    Private Sub RightClick_Popup(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RightClick.Popup
            sender.checked = False
        End Sub
    but when my program is run i get this this error: Public member 'checked' on type 'Context Menu' not found.

    why isn't this working? what can i do to make this work?

    Thanks.
    Last edited by Psychotron; Sep 5th, 2002 at 08:43 AM.

  2. #2
    Member
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    39

    Lightbulb maybe this works...

    Instead of sender.checked try chkboxname.checked = false

    Dozo

  3. #3
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Because "Checked" is not a property of "Object".
    You could cast it to a Checkbox first though.

    (not tested but should work)
    Dim MyCheckBox as Checkbox
    MyCheckBox = CType(sender, Checkbox)
    MyCheckbox.Checked = False

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    121
    this didn't work. this time it said 'specified cast is not valid.'

    so does than mean i can't cast it to a checkbox? can i cast it to something else then?

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Is RightClick your popup menu?
    In that case sender would be the popup menu and not the checkbox.
    Try this:
    sender.sourcecontrol.checked = True

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    121

    resovled

    that did the trick! thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width