VB.NET Question - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HUKD, you accept our cookie and privacy policy.
Get the HUKD app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

VB.NET Question

SAVE4IT Avatar
6y, 11m agoPosted 6 years, 11 months ago
I am trying to ensure that for a user the text box must be completed/filled in.

If it is not then an error message should appear (Message box) and it should remain on that form

If it is filled in then it should procced onto the other form. Hiding the name form

If you understand, would be great if you could lend me a hand :)
SAVE4IT Avatar
6y, 11m agoPosted 6 years, 11 months ago
Options

All Comments

(3) Jump to unreadPost a comment
Comments/page:
#1
trap the focus lost event and do a
if txtbox.text = "" then txtbox.setfocus()
#2
Or you could create a errorprovider on the form then on the4 textbox put validating as method name
If TextBox1.Text = "" Then
ErrorProvider1.SetError(TextBox1, "Please fill in form")
e.Cancel = True
Else
ErrorProvider1.SetError(TextBox1, "")
Form2.show
Me.Hide
End If

that would stop them navigating away from the textbox and tell them why they cant
#3
I can't give you the VB code for it but the general approach I'd take it to tap the box's status changed or text entered/deleted event(s) and then update the error label and proceed permission variable based on that.

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!