Hey,
Some help please!
I am trying an encrypting exercise which takes the txtmessage and encrypts it in characterarray.
IStartAt is the starting point and by taking one character at a time from txtmessage I need to insert it in characterarr\y allowing a gap in between which is IUseGap. KeyGap and Keyfirst will be the next two characters after txtmessage and when insert have no gap in between.
I think the logic I done is good however, I get syntax errors on the red lines.
Please Help me get this right. Many thanks
Code:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsecrettMessage.Click 'Splitletters() Dim KeyFirst, KeyGap, secretmessage As String Dim encodestring As String = txtmessage.Text lStartAt = 200 + lUse5th Dim lPos As Long KeyFirst = Asc(encodestring(0)) KeyGap = (Asc(lUseGap)) encodestring += String.Format(KeyFirst + KeyGap) For lPos = 1 To encodestring.Length characterarray.Substring(((lPos - 1) * lUseGap) + lStartAt) = encodestring.Substring(lPos - 1) If (encodestring.Length - 2 = True) Then characterarray.replace (1Pos+1,KeyFirst) End If If (encodestring.Length - 1 = True) Then characterarray.replace (1Pos+2,KeyGap) End If Next secretmessage = characterarray.ToString End Sub





Reply With Quote