Wrox Programmer Forums
|
Visual Basic 2010 General Discussion For any discussions about Visual Basic 2010 topics which aren't related to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2010 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2010, 11:43 PM
Registered User
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default a newbie need help!

Hi, everyone!
Like the title of my topic says, i'm newbie. Since last week i'm work hard to simply try to do a textbox that a user will fillup with 6 caracters but the condition is the first char. is a letter then the next one is a number then a letter... until we got a total of 6 caracters???

Honnestly, i try many thing whitout succes! And i pretty convicted that is actualy some basic coding!

Please, if someone can help me!

thanks.
 
Old October 4th, 2010, 02:16 AM
Authorized User
 
Join Date: Sep 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default here u go!

Private Sub TextBox3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Dim str As String = ""
Dim substr As String = ""
Dim i As Integer = 0

str = TextBox3.Text
i = str.Length
If (str.Length > 6) Then

TextBox3.Text = str.Substring(0, str.Length - 1)
TextBox3.SelectionStart = TextBox3.Text.ToString.Length
Return
End If
If str <> "" Then
substr = str.Substring(str.Length - 1, 1)
If (i Mod 2 = 0) Then
If Not (IsNumeric(substr)) Then

TextBox3.Text = str.Substring(0, str.Length - 1)
TextBox3.SelectionStart = TextBox3.Text.ToString.Length
Exit Sub
End If
Else
If (IsNumeric(substr)) Then
TextBox3.Text = str.Substring(0, str.Length - 1)
TextBox3.SelectionStart = TextBox3.Text.ToString.Length
Exit Sub

End If
End If

End If
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help the newbie!! shelly.aix Visual Basic 2008 Essentials 2 December 16th, 2008 07:35 AM
Newbie here jmac731976 HTML Code Clinic 13 August 29th, 2007 03:54 PM
NEWBIE HELP tready Beginning PHP 1 May 24th, 2006 06:41 AM
newbie richardtr Beginning PHP 13 August 7th, 2004 10:44 AM
newbie help pcm ADO.NET 1 December 18th, 2003 09:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.