Results 1 to 12 of 12

Thread: Syntax error in string manipulation

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Syntax error in string manipulation

    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
    Last edited by angelica; Apr 15th, 2009 at 05:51 AM.
    ------------------------------------------------------------------------
    If an answer to your question has been helpful, then please, Rate it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width