Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

-----------------

It�s always funny until someone gets hurt� Then it become hilarious!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...