Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > How to get or read the last letter from a text box? - Vb.net or VS 2005
 

How to get or read the last letter from a text box? - Vb.net or VS 2005

Hi

I have a TextBox in a windows form to enter 10 digit number followed by 2 letters.

(Ex: 304528929GH)

I have a code (got from my other thread) to calculate the totalof the above digits(3+0+4+....) and dividing the total by someother value to get the reminder. IT ALL WORKS FINE

Also I have list of alphabets with equivalant value like below

A = 3
B = 7
C = 1
H = 12
........
........
Z = 22

My question: If the reminder matches one of the above list , for example reminder from the above calculation
is 12. So it matches with H = 12. So If H is the last letter of 304528929GH, then the user input is right.

In Short: HOW DO I GET THE LAST LETTER (ex. 'H' in the above case) From the textbox and check with alphabatical list listed above

advance thanks

Vaish  Thursday, February 01, 2007 4:14 AM


Dim s As String = "304528929GH"

MessageBox.Show(s.Substring(s.Length - 1))


Ken Tucker  Thursday, February 01, 2007 4:20 AM


Dim s As String = "304528929GH"

MessageBox.Show(s.Substring(s.Length - 1))


Ken Tucker  Thursday, February 01, 2007 4:20 AM

Hi Ken

Thanks a lot again. Thank you.

Vaish

Vaish  Thursday, February 01, 2007 4:30 PM

You can use google to search for other answers

Custom Search

More Threads

• Is there an easy way to transpose a Datagridview?
• how to calls functions that are in win app class file from the web page that is displayed in the webbrowser control of win application?
• Datagridview...
• mdb file
• Visual Studio 2008 - "DataSet Project" Property in Typed DataSet
• DatagridView
• Drag and drop in data grid view
• DataGridView & Concurrency Errors - Key Related?
• RowHeaderCell Change Selected Row Image
• Bolding/Coloring a single word in a grid cell