ukjock Posted January 5, 2004 Posted January 5, 2004 Hi guys, wondering if you can help me with this code. I want to subtract 1 from a letter so for example if I subtracted one from the letter B then it would become A. I am doing this because I am unsure what letter is going to be in the label. I thought this code might work but it returns an error of: An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll Additional information: Cast from string "B" to type 'Double' is not valid. What do you think?? Dim NewLetter As String Dim LetterLine1 As String Dim LetterLine2 As String LetterLine1 = Label12.Text LetterLine2 = Label13.Text If Asc(LetterLine2) > Asc(LetterLine1) Then NewLetter = Chr(Asc(LetterLine2 - 1)) End If Thanks for reading Chris. Quote ----------------- It�s always funny until someone gets hurt� Then it become hilarious!
sharpcoder Posted January 5, 2004 Posted January 5, 2004 NewLetter = Chr(Asc(LetterLine2) - 1) maybe? hmm Quote
ukjock Posted January 5, 2004 Author Posted January 5, 2004 top man Sharpcoder! U R A * Quote ----------------- It�s always funny until someone gets hurt� Then it become hilarious!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.