Jhovyn Marcos
asked on
how to know if my Checkbox is True in VB6.0?
Sir I have a Question.......I have 2 Forms namely "form1" and "form2"....how do I call my checkbox in form2 if it is True? Can you give me some simple code?
If Form2.MyCheckBox.Value = True then 'Or vbChecked in place of True
you should always use vbChecked and vbUnChecked intrinsic constants when determining checkbox value. True is not equal to vbChecked
A Vb6 checkbox can actually have 3 values:
vbChecked or Checked, both of which = 1
vbUnChecked or UnChecked, both of which = 0
vbGrayed which is 2
vbChecked or Checked, both of which = 1
vbUnChecked or UnChecked, both of which = 0
vbGrayed which is 2
ASKER
In my "form1" I have this code
Private Sub chkRegisteredLocation_Clic k()
If checkbox1.value = 1 Then
datacombo1.Enabled = True
Else
checkbox1.Enabled = False
datacombo1.Text = ""
End If
End Sub
Now in my "form2" how do I know if my checkbox1 is True or Checked?
Private Sub chkRegisteredLocation_Clic
If checkbox1.value = 1 Then
datacombo1.Enabled = True
Else
checkbox1.Enabled = False
datacombo1.Text = ""
End If
End Sub
Now in my "form2" how do I know if my checkbox1 is True or Checked?
Hi,
Try like below- <<txt is a text box from form2.>>
txt.text = form1.checkbox1.Value
Hope it helps!
Try like below- <<txt is a text box from form2.>>
txt.text = form1.checkbox1.Value
Hope it helps!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If it is set to three state it can have more than two values.
ASKER
Thank you :)
You're welcome and I'm glad I was able to help.
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.
Marty - Microsoft MVP 2009 to 2016
Experts Exchange MVE 2015
Experts Exchange Top Expert Visual Basic Classic 2012 to 2015