cancel
Showing results for 
Search instead for 
Did you mean: 

.value to set a checkbox

SOLVED
Morgan
Frequent Contributor

.value to set a checkbox

I want to set a checkbox to checked using the .value property (which returns checked or unchecked).  The property says it can also SET the checkbox but I'm having trouble doing that for whatever reason.  I'm sure it's simple.... help?  (using VB)



Morgan
1 ACCEPTED SOLUTION

Accepted Solutions
murugans1011
Regular Contributor

RE: .value to set a checkbox

Try using



   chkobj.Value=0 or chkobj.Value=1

  

   0- unchecked

   1-checked



instead u can also use



    chkobj.Clickbutton(cbChecked) or chkobj.Clickbutton(cbUnchecked)

View solution in original post

4 REPLIES 4
murugans1011
Regular Contributor

RE: .value to set a checkbox

Try using



   chkobj.Value=0 or chkobj.Value=1

  

   0- unchecked

   1-checked



instead u can also use



    chkobj.Clickbutton(cbChecked) or chkobj.Clickbutton(cbUnchecked)

View solution in original post

Morgan
Frequent Contributor

RE: .value to set a checkbox

Thank you!  I used the first approach and it worked perfectly!
sbkeenan
Frequent Contributor

RE: .value to set a checkbox

Hi Morgan



You may also find that your checkbox control has a native Set_Checked method, that accepts either a true or false parameter.  I find that this tends to make the code slightly easier to read.  For example, if your control is referenced by the variable chkCtrl, then you could use something like:





chkCtrl.Set_Checked(true)      'this will check the checkbox control.



chkCtrl.Set_Checked(false)    'this will un-check the checkbox control.





Regards

Stephen.
Morgan
Frequent Contributor

RE: .value to set a checkbox

Valid point!  I'll look into that.  Thank you!  
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors