how could I do this !!! ?

You can talk about VB programming here

how could I do this !!! ?

Postby dNightMare » Thu Feb 02, 2006 8:27 am


Hey peeps,
I need to know how to make some kind of an encryption in vb .I mean for example 2 text boxes with one commad button . when the user puts the text in the fist box his message is encrypted with a simple key . lets say when the user inputs "AAAA" the message in the second box shows "ZZZZ" for example I hope this idea is clear :) sorry I'm starting to play with vb so not much I know :( . I searched google many times but no luck I hope to find a solution in your great forum and please would you put an example :lol:

Regargs.
dNightMare
 
Posts: 3
Joined: Thu Feb 02, 2006 8:20 am

Postby locohacker » Thu Feb 02, 2006 11:23 am

I think you can do it like this

Code: Select all
Sub script()
Text2.Text = Replace(Text1.Text, "a", "â")
Text2.Text = Replace(Text1.Text, "b", "ß")
Text2.Text = Replace(Text1.Text, "c", "Ç")
Text2.Text = Replace(Text1.Text, "d", "Ð")
Text2.Text = Replace(Text1.Text, "e", "ë")
Text2.Text = Replace(Text1.Text, "f", "F")
Text2.Text = Replace(Text1.Text, "g", "G")
Text2.Text = Replace(Text1.Text, "h", "H")
Text2.Text = Replace(Text1.Text, "i", "í")
Text2.Text = Replace(Text1.Text, "j", "J")
Text2.Text = Replace(Text1.Text, "k", "K")
Text2.Text = Replace(Text1.Text, "l", "£")
Text2.Text = Replace(Text1.Text, "m", "M")
Text2.Text = Replace(Text1.Text, "n", "Ñ")
Text2.Text = Replace(Text1.Text, "o", "0")
Text2.Text = Replace(Text1.Text, "p", "þ")
Text2.Text = Replace(Text1.Text, "q", "Q")
Text2.Text = Replace(Text1.Text, "r", "R")
Text2.Text = Replace(Text1.Text, "s", "§")
Text2.Text = Replace(Text1.Text, "t", "T")
Text2.Text = Replace(Text1.Text, "u", "ú")
Text2.Text = Replace(Text1.Text, "v", "V")
Text2.Text = Replace(Text1.Text, "w", "W")
Text2.Text = Replace(Text1.Text, "x", "×")
Text2.Text = Replace(Text1.Text, "y", "Ý")
Text2.Text = Replace(Text1.Text, "z", "Z")
End Sub


then on a command button

Code: Select all
call script


so what ever you type on text1 will be change on text two :) and u need to change to what u want to change the letter too for example Text2.Text = Replace(Text1.Text, "a", "â") you can change it, lets say you want a to be z then u do it like this Text2.Text = Replace(Text1.Text, "a", "z") thats it, I think there othe ways but thats the way i done it :D
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4361
Joined: Fri Dec 31, 2004 6:59 pm

Postby dNightMare » Thu Feb 02, 2006 12:46 pm

wow thank you so much locohacker :) . I can't wait I'll try it .


Thanks again :) tc .
dNightMare
 
Posts: 3
Joined: Thu Feb 02, 2006 8:20 am

Postby dNightMare » Fri Feb 03, 2006 7:12 am

Hi locohacker .
I tried your code but it only processes the last line : i.e:

Code: Select all
Text2.Text = Replace(Text1.Text, "y", "Ý")
Text2.Text = Replace(Text1.Text, "z", "Z")


the remaining lines just pasted the same char for example y printed as y not "Ý" :/
please I need help I want it to process all the chars any ideas whats wrong !!!

Thanks in advance.
dNightMare
 
Posts: 3
Joined: Thu Feb 02, 2006 8:20 am

Postby locohacker » Fri Feb 03, 2006 10:36 am

umm thas weird are u using capitals letters, another thing send me ur code private if u want me to take a look at it 8)
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4361
Joined: Fri Dec 31, 2004 6:59 pm


Return to Visual Basic Programming

Who is online

Users browsing this forum: No registered users and 0 guests