ARC
Well-known member
I'm trying to get the 'space-less' messege, one letter at a time, and convert that letter into a number between 1 and 26. I'm doing so by turning the letter into ascii value, then minus 96. a = 97 so 97 - 96 = 1. a is the first letter of the alphabet. Then, i use that number (1) in cunjunction with the same process to the keyword letter, to pull a number out of an array i have created in the formload. I then take that pulled number and CHR() it to give me the codedChar, then display it in the uiOutput text box.
The problem im having is with my loop. It's not looping past the first letter for either the keyword, or the messege... but it does fire the correct number of times according to mLength.
I know that this isnt controling the To.Lower yet, but for now i'm just making sure i enter the keyword and messege in all lowercase. I know how to do that, so that's not what i'm worried about yet.
Any suggestions would be great.
EDIT:: the only thing I can think of, is it's some problem with the math being outside of the loop. So i'm gunna try that next, by bringing what i can inside.
This didnt work either::
The problem im having is with my loop. It's not looping past the first letter for either the keyword, or the messege... but it does fire the correct number of times according to mLength.
I know that this isnt controling the To.Lower yet, but for now i'm just making sure i enter the keyword and messege in all lowercase. I know how to do that, so that's not what i'm worried about yet.
Any suggestions would be great.
EDIT:: the only thing I can think of, is it's some problem with the math being outside of the loop. So i'm gunna try that next, by bringing what i can inside.
VB.NET:
Dim messege As String = Me.uiInput.Text.Replace(" ", "")
Dim keyWord As String = Me.uiKeyWord.Text
Dim mLength As Integer = Len(messege)
Dim kLength As Integer = Len(keyWord)
Dim mCounter As Integer = 1
Dim kCounter As Integer = 1
Dim mTempLetter As String = Microsoft.VisualBasic.Left(messege, mCounter)
Dim kTempLetter As String = Microsoft.VisualBasic.Left(keyWord, kCounter)
Dim mASC As Integer = (Asc(mTempLetter) - (96))
Dim kASC As Integer = (Asc(kTempLetter) - (96))
Dim codedChar As String
Me.uiOutput.Text = ""
Do While mCounter <= mLength
codedChar = Chr(aGrid(kASC, mASC))
Me.uiOutput.AppendText(codedChar)
mCounter += 1
kCounter += 1
Loop
This didnt work either::
VB.NET:
Dim mLength As Integer
Dim kLength As Integer
Dim mTempLetter As String
Dim kTempLetter As String
Dim mCounter As Integer
Dim kCounter As Integer
Dim ascK As Integer
Dim ascM As Integer
Dim kTemp As Integer
Dim mTemp As Integer
Dim codedInt As Integer
Dim codedChar As String
mLength = Len(Me.uiInput.Text)
kLength = Len(Me.uiKeyWord.Text)
mCounter = 1
kCounter = 1
For mCounter = 1 To mLength
mTempLetter = Microsoft.VisualBasic.Left(Me.uiInput.Text, mCounter)
kTempLetter = Microsoft.VisualBasic.Left(Me.uiKeyWord.Text, kCounter)
ascM = Asc(mTempLetter)
ascK = Asc(kTempLetter)
mTemp = ((ascM) - (96))
kTemp = ((ascK) - (96))
codedInt = aGrid(mTemp, kTemp)
codedChar = Chr(codedInt)
Me.uiOutput.AppendText(codedChar)
kCounter += 1
Next mCounter
Last edited: