Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
validations for textboxes in visualbasic 6.0 for user forms where user is supposed to enter the data and the software should validate it

What I have tried:

if textbox1.text="" then msgbox("invalid")
Posted
Updated 6-Sep-19 20:38pm
Comments
Patrice T 7-Sep-19 4:33am    
What is the problem with this code ?
Dave Kreskowiak 7-Sep-19 9:31am    
You never described what the problem was with your code.

Also, why on earth are you using VB6? It's been dead for decades.

1 solution

VB
If (TextBox1.Text = "") Then
           MsgBox("Invalid")
End If


it will just check whether textbox is empty or not.
is textbox is empty it will display invalid in the message box.
this code you have to write on some event of some control like button.
 
Share this answer
 
v3
Comments
Patrice T 7-Sep-19 5:20am    
your code is exactly the same as in question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900