We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,520 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Making the rules of a text box

Hello guys,

I've newly joined this forum since I want to enhance my knowledge in Programming specially in Visual Basic.

So for the important part, right now I'm planning on creating a word detector somehow and there are specific rules I was to set in the textbox in relation with the button.
Let's say I wanna set an IF Statement for the text to have 32 characters and letters "abcdefg" and numbers "12345" so that it'll execute a message box when I press the button.

Here's a code example of what I'm saying

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text.Length.Equals(32) Then
            MessageBox.Show("You word has 32 Characters")
        End If
    End Sub

As you can see, I've set a rule that a message box will pop up if the word has 32 characters.
But I need to set another rule at the same time in which the word will have only letters "abcdefg" and numbers "12345"

Any ideas?
Help would be appreciated
Thanks in advance
zerofreak@live.com

2
Contributors
2
Replies
3 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
zerofreak
Newbie Poster
8 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Actually this section for VB 4/5/6, and your code is for VB.Net Section.
For your question.
I suggest to trap any character except "abcdefg" and "12345" when user type it on textbox. So user only can input "abcdefg" or "12345".

Jx_Man
Senior Poster
3,538 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 524
Skill Endorsements: 64

Thanks for the reply, gonna post a thread like this in the VB.Net section

zerofreak
Newbie Poster
8 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.2967 seconds using 2.67MB