Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello, i'm trying to make a "registration form", so i have "name" "username" "password" and so on, and what i'm trying to do is: when the person clicks on " register", in case there is any textbox unfilled, it will detect it, and appear like in a msgbox("Make sure you have fulfilled all cases"). Thank you
Posted
Comments
Sergey Alexandrovich Kryukov 13-Feb-15 11:32am    
It depends on what you mean by "VB" and what UI library you use.
—SA
Member 11447662 13-Feb-15 11:35am    
I'm doing this on visual basic 2010
Sergey Alexandrovich Kryukov 13-Feb-15 11:40am    
What UI library you are using? What is the application type? Do you think there is only one? :-)
I already answered the question. Now, read on the events of the controls.
—SA
Sergey Alexandrovich Kryukov 13-Feb-15 11:43am    
I added two links to my answer, after [EDIT].
But you shouldn't ask questions these way. It's too bad to waste time on guesswork and show different variants to different UI libraries.
—SA
Member 11447662 13-Feb-15 11:48am    
Thank you ;) I'm really determined on learning this, so yeah, I should start from the bottom.

1 solution

From the state of the text box, you cannot find difference between the text box which content was never modified by the user and the one with the text of empty string. The user could add some text and then delete it, consciously, and you would not detect the difference between this situation and the initial state of this control, if it is the same.

Therefore, for more fine-grain detection of the presence of some user input, you need to store this information (any kind of flag) outside of this control, say, in some instance member of your form. You would need to handle the "changed" event of the control. In the handler, you should modify this outside flag.

The exact technique to be used depends on what you mean by "VB" and what UI library you use. You can easily find out how to handle events, by reading documentation on the library you use.

[EDIT]

For example, you may need to handle one of these events:
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.textchanged%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.datacontextchanged%28v=vs.110%29.aspx[^].

If you are using something else (not WPF, not System.Windows.Forms or some older version not having the event I referenced), you have to ask about it specifically.

—SA
 
Share this answer
 
v2

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