Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect TextBox Use

Status
Not open for further replies.

Tobin1

Petroleum
Nov 9, 2007
176
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?


Tobin Sparks
 
Replies continue below

Recommended for you

The Checkbox1.Enabled value tells you if the chewckbox is enabled - not whether it is selected. Use The Checkbox1.Value to find if it is checked or not.

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 before posting
Steam Engine enthusiasts
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor