Help?

liquidspaces

Regular
Joined
Nov 19, 2002
Messages
74
Location
Richmond, VA
Here's what I need: On my form, I have a field that needs to be enabled while everything else is disabled. That's no problem, but it's with the next step that I have issues.

Everything else will stay disabled until the first character is entered into this field. That character will be saved in the database, and at that time, everything else will become enabled. I'm having a terrible time checking this field's value to see if anything has been entered into it.

This is necessary because I need the autonumber generation from my database to appear as soon as possible.

Any help is appreciated.
Kevin
 
Sorry for not being clear.

I need to check the text box to see if there are characters in it. I BELIEVE I can get it to work with an if statement:

if txtName.Text = " " Then
everthing.enabled = false
end if

Everything starts out disabled just like it should. But there has to be in a loop, and I can't get the loop to work right. I tried it like this:

if txtName.text = " " then

while txtName.Text = " "
everything.enabled = false
end while

else

everything.enabled = true

end if

This doesn't even load. I've tried taking out the if's, but it crashes even harder.
 
The TextBox class has a TextChanged event.
Visual Basic:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    If TextBox1.Text.Length > 0 Then
        'Enable controls
    End If
End Sub
 
Awesome! Everything is now working as planned. I hadn't even thought about a textbox event, I was trying to do it in the form load event.

Thanks a lot,
Kevin
 
Back
Top