×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Detect TextBox Use

Detect TextBox Use

Detect TextBox Use

(OP)
Hi All,
I'm new to VB and I'm in over my head. smile
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

Replies continue below

Recommended for you

RE: Detect TextBox Use

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: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints

RE: Detect TextBox Use

(OP)
johnwm,
Thank you very much, that will be helpful to me.
 

Tobin Sparks
www.nov.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close