Code Problem

ukjock

Freshman
Joined
Dec 10, 2003
Messages
35
Location
Scotland
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??

Visual Basic:
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.
 
Back
Top