Detect TextBox Use
Detect TextBox Use
(OP)
Hi All,
I'm new to VB and I'm in over my head.
I have a form with two TextBoxes and a few CheckBoxes.
I'm using the following to detect if the CheckBoxes are Checked:
Private Sub CheckBox1_Click()
If CheckBox1.Enabled = True Then
Settings(4) = 1
Else
Settings(4) = 0
End If
End Sub
This works great for what I'm doing with the CheckBoxes.
But, how can I detect if the User has entered text into the TextBox so I can either use the text or ignore the TextBox completely?
Something like:
Private Sub TextBox1_Click()
If TextBox1.Char = True Then
Settings(0) = 1
Else
Settings(0) = 0
End If
Can anybody help me?
I'm new to VB and I'm in over my head.
I have a form with two TextBoxes and a few CheckBoxes.
I'm using the following to detect if the CheckBoxes are Checked:
Private Sub CheckBox1_Click()
If CheckBox1.Enabled = True Then
Settings(4) = 1
Else
Settings(4) = 0
End If
End Sub
This works great for what I'm doing with the CheckBoxes.
But, how can I detect if the User has entered text into the TextBox so I can either use the text or ignore the TextBox completely?
Something like:
Private Sub TextBox1_Click()
If TextBox1.Char = True Then
Settings(0) = 1
Else
Settings(0) = 0
End If
Can anybody help me?
Tobin Sparks
www.nov.com
RE: Detect TextBox Use
For the Textbox use Len(Textbox1.Text). Empty will produce 0 (which will evaluate to False in an If statement) - with characters it will produce the length of the string (which will evaluate to True for any non-zero value)
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints
RE: Detect TextBox Use
Thank you very much, that will be helpful to me.
Tobin Sparks
www.nov.com