Results 1 to 4 of 4

Thread: just a quick question...

  1. #1
    Guest
    You ever have one of those days when you just wish that someone were to accidentaly (and repeatedly) smash your workstation with a sledgehammer?

    I am trying to programmaticaly set the value of a checkbox programmaticaly.... and I keep getting an error (invalid protperty value). Thinking that it might be something incredibly odd with my project, I open up a brand spankin new window (with one checkbox named 'Check1').

    I then add a command button.. to the button's click event, I add the code "Check1.Value = True". Now this SHOULD work, as when I enter break mode it is responding to a ? Check1.Value .... but when I execute it it gives me the same bloody error (Invalid Property Value... or something to that extent).

    What I need to know is a) should this work (I know the answer but it does not hurt to be certain)

    b) have any of you EVER seen this happen? If so, how did you resolve it?

  2. #2
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Wink Wrong Type

    The CheckBox.value Doesn't use boolean it uses integer like this
    Code:
    Check1.Value=1 'To Checkit
    Check1.Value=0 'To Uncheckit

    Saludos...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  3. #3
    Guest

    ...

    Ok, now I am just baffled. What you say works, but this particular code was WORKING a little while ago. I'm working on a form that had been designed by someone else, but that needed reworking. The code to handle the checkboxes was code that I did not touch and, IIRC, worked prior to the redesign (at the VERY least it gave no errors).

    In any case, thanks for the info.

  4. #4
    Lively Member flint's Avatar
    Join Date
    Oct 2000
    Posts
    67

    Cool Try this approach


    Code:
    Private Sub Check1_Click()
       If Check1.Value = vbChecked Then
          Check1.Caption = "Checked"  'Or put the code that you want to execute when checked
       ElseIf Check1.Value = vbUnchecked Then
          Check1.Caption = "Unchecked" 'Or put the code that you want to execute when unchecked
       End If
    End Sub
    Hope this helps

    Cordially,
    Flint

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