Computing.Net > Forums > Programming > Text Box in vb6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Text Box in vb6

Reply to Message Icon

Name: gardenair
Date: August 8, 2004 at 11:05:14 Pacific
OS: win98
CPU/Ram: 450
Comment:

In Visual Basic6 I have two text boxes & a save button. I want that if there is no data in both text boxes
i.e Text1 ,Text2 then it will show a message that input data in any of them.
If there is data in Text1 & Text2 is empty and Vice Versa then my command button will work.
Please guide me that how can i do that.
Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: August 8, 2004 at 14:37:40 Pacific
Reply:

if text1.text > "" OR text2.text > "" then
command1.enabled = true
else
Command1.enabled = false


Put this code in the Text.change event for each of the text boxes


Stuart


0

Response Number 2
Name: egkenny
Date: August 8, 2004 at 14:48:46 Pacific
Reply:

This will enable the Save button if either text box has text in it. If you can have text in only one box then you will have to change it.

Private Sub Text1_Change()
CheckForData
End Sub

Private Sub Text2_Change()
CheckForData
End Sub

Sub CheckForData()
If Text1.Text = "" Or Text2.Text = "" Then
EnterDataLabel.Visible = True
Else
EnterDataLabel.Visible = False
End If
If Text1.Text = "" And Text2.Text = "" Then
SaveButton.Enabled = False
Else
SaveButton.Enabled = True
End If
End Sub


0

Response Number 3
Name: gardenair
Date: August 8, 2004 at 18:43:33 Pacific
Reply:

Thanks Alert & egkenny for the guidence.The code is working fine.My result for the save button is now working fine.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Text Box in vb6

vb text boxes www.computing.net/answers/programming/vb-text-boxes/12194.html

Text Box in the VB.Net www.computing.net/answers/programming/text-box-in-the-vbnet-/15822.html

VB6....Nul value in text box www.computing.net/answers/programming/vb6nul-value-in-text-box/5524.html