ExclamationSolvedInput Validation For TextBox

Posts 1–13 of 13 · Page 1 of 1
Input Validation For TextBox
what shoult be the code for this, the textbox allow only character ( A, B, C, D, E, F) and numbers( 0 to 9 )

sample I input this in textbox: A34BC89

then it will show a message box text "GOOD"

if the text in textbox is: %^&*ZPLKH

then it will show a message box text : "Wrong Input"
You could try regex
Code:
    Public Function IsHex(ByVal Val As String) As Boolean
        Return System.Text.RegularExpressions.Regex.IsMatch(Val, "\A\b[0-9a-fA-F]+\b\Z")
    End Function
or with a message box
Code:
    Public Sub IsHex(ByVal Val As String)
        MessageBox.Show(If(System.Text.RegularExpressions.Regex.IsMatch(Val, "\A\b[0-9a-fA-F]+\b\Z"), "Good", "Wrong Input"))
    End Sub
People tend to spoonfeed even without explaining what the code does.. I wonder why.. =\ At least if you are going to give code, explain it so He can actually learn and not only copy&paste it.

I bet he has no idea what regex even is.
Quote Originally Posted by 'Bruno View Post
People tend to spoonfeed even without explaining what the code does.. I wonder why.. =\ At least if you are going to give code, explain it so He can actually learn and not only copy&paste it.

I bet he has no idea what regex even is.
Becuase i didnt want to waste 5min of my day explaining the code to someone who is probably gonna copy/paste anyway.
If he was asking something more complex or was an older member, yea maybe. But im hungover and cant be bothered.
THANK YOU SO MUCH PINGO.....!!! ^_^ ITs working.... Ive done my sample project...as a beginner in VB... KEEP IT UP!!
First project... doing it totally wrong.. meh, I give up.
Let him do what he do.
Quote Originally Posted by 'Bruno View Post
First project... doing it totally wrong.. meh, I give up.
Quote Originally Posted by DawgiiStylz View Post
Let him do what he do.
Im not stopping anyone. But that it is wrong, it is.
Quote Originally Posted by 'Bruno View Post
Im not stopping anyone. But that it is wrong, it is.
Instead of complaining, post the correct solution.
Quote Originally Posted by Pingo View Post
Instead of complaining, post the correct solution.
Nope, giving code is for weak people. And you already gave code.
Also I do not understand, if you had no time, wouldn't you spend less time just typing "Search about "regural expressions" on MSDN? Instead of writing the code(And not explaining)?
This is the reason why this forum is full of leechers, this section helps to it when it shouldn't. Most of the time what these people do is steal others work/creations and claiming as their own without a single credit. And thats how they end up learning (Or not really learning).

But no, you are doing the correct thing for sure. (Perhaps thats how you started too.. leeching)
Im weak and a leecher!
Someone got mad
Quote Originally Posted by Pingo View Post
Im weak and a leecher!
Someone got mad
Weak for the guy asking... jeez. ("And you already gave code" was the answer when you said for me to post the solution)
And never said you are a leecher.

Move on if you are going to reply with "mad" arguments. Because of lack of arguments.

Just not agreeing with the ways you help. And since this is a open board, i can express my opinion. You dont have to reaply to it tho..
Quote Originally Posted by 'Bruno View Post
Weak for the guy asking... jeez. ("And you already gave code" was the answer when you said for me to post the solution)
And never said you are a leecher.

Move on if you are going to reply with "mad" arguments. Because of lack of arguments.

Just not agreeing with the ways you help. And since this is a open board, i can express my opinion. You dont have to reaply to it tho..
Sorry i misread the comment. I understand what you're though, but im one of those who doesnt mind spoon feeding.
Not because i was spoonfed myself, i just dont care. If someone really wants to learn, they wouldnt be asking simple questions that can be found on MSDN.
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?