Click here to Skip to main content
15,745,620 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")
Updated 6-Sep-19 20:38pm
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

If (TextBox1.Text = "") Then
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
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