|
-
Aug 11th, 2012, 05:24 PM
#1
Thread Starter
New Member
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...)
-
Aug 11th, 2012, 08:22 PM
#2
Re: Please help me develop my cryptogram Encoder / Decoder
Which version of Visual Basic are you using?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Aug 21st, 2012, 02:20 AM
#3
New Member
Re: Please help me develop my cryptogram Encoder / Decoder
hi
i use visual basic 6 for programming
-
Aug 22nd, 2012, 12:54 AM
#4
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
-
Aug 22nd, 2012, 02:13 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|