Results 1 to 5 of 5

Thread: Please help me develop my cryptogram Encoder / Decoder

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    1

    Question Please help me develop my cryptogram Encoder / Decoder

    I am trying to make a program on Visual Basics that lets me basically type a message in a text box for example (Hello, How are you doing) and make it come out on Texbox 2 when i click (encrypt) saying (QREEO, QOE XFR KOB FOJNG).. Or if i typed (QREEO, QOE XFR KOB FOJNG) and i click (decrypt) have it come out textbox 2 saying (Hello, How are you doing). Now obvisuly i dont care about case-sensitivity but I do want to be able to code the program so that it know my (secret language) and can translate something back to me if I want it to.. I was thinking I could like code the buttons to have the textbox like say (if textbox1 = "A" then textbox2 = "R" ... something like that I have like really little expierence coding but i do know how to use the program. So I know its alot but code someone at least get me started on what the coding would even be or some suggestions... (Its not all random its an actual code that i put together...)

  2. #2
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 01
    Location
    Adelaide, Australia
    Posts
    9,739

    Re: Please help me develop my cryptogram Encoder / Decoder

    Which version of Visual Basic are you using?
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    DON'T BUMP YOUR POSTS!!! Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  3. #3
    New Member
    Join Date
    Jun 12
    Posts
    3

    Re: Please help me develop my cryptogram Encoder / Decoder

    hi
    i use visual basic 6 for programming

  4. #4
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,744

    Re: Please help me develop my cryptogram Encoder / Decoder

    Hello,

    Since this is a VB6 question, I am going to move it to the VB6 Forum.

    By the way, pixxeldigital you replied to a thread which was started by Stoowyguy, are both of these your accounts?

    Gary

  5. #5
    PowerPoster
    Join Date
    Jul 06
    Location
    Maldon, Essex. UK
    Posts
    5,157

    Re: Please help me develop my cryptogram Encoder / Decoder

    Here's something to get you started
    Code:
    Option Explicit
    Dim strCode As String
    
    Private Sub cmdCode_Click()
    Dim strToCode As String
    Dim strCoded As String
    Dim intI As Integer
    Dim intChr As Integer
    Dim intPos As Integer
    strToCode = UCase(Text1.Text)
    For intI = 1 To Len(strToCode)
        '
        ' Pick up the next character in the data to encode
        ' Convert to ASCII
        ' If it's a space then don't encode it
        ' Use the ASCII value to index into the Code String
        ' and pick up up that character as the encoded letter
        ' Repeat for all data to be encoded
        '
        intChr = Asc(Mid$(strToCode, intI, 1))
        If intChr <> 32 Then
            intPos = intChr - Asc("A")
            strCoded = strCoded & Mid$(strCode, intPos + 1, 1)
        Else
            strCoded = strCoded & " "
        End If
    Next intI
    Text2.Text = strCoded
    End Sub
    
    Private Sub cmdDecode_Click()
    Dim strCoded As String
    Dim strDecode As String
    Dim strChr As String
    Dim intI As Integer
    Dim intPos As Integer
    strCoded = Text2.Text
    For intI = 1 To Len(strCoded)
        '
        ' Pick up the next encoded character
        ' Find its position within the Code String
        ' If it's not found then it must be a Space Character
        ' If it is found then convert the position to an ASCII Character
        ' in the range A to Z
        ' Add it to the decoded data
        '
        strChr = Mid$(strCoded, intI, 1)
        intPos = InStr(strCode, strChr)
        If intPos > 0 Then
            intPos = intPos + Asc("A") - 1
            strDecode = strDecode & Chr(intPos)
        Else
            strDecode = strDecode & " "
        End If
    Next intI
    Text3.Text = strDecode
    End Sub
    
    Private Sub Form_Load()
    strCode = "QAZWSXEDCRFVTGBYHNUJMIKOLP"
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    End Sub
    I'll leave you to work out how to cope with numerics, punctuation and lower case letters. (It's not much fun for you if we do it all for you !)

Posting Permissions

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