473,796 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating an "Encoder/Decoder" in VB

16 New Member
Basically my friend's parents used to log his AIM and email so we made a barbaric version of an encoder that we could type in what we wanted and get random letters out. The only problem is that I did it in Truebasic, and I am new to VB. I have the interface layed out with an Encode button and a Decode button with an Input and an output/log. Eventually I want to have it just with universal hotkeys to where you can highlight a text and it automatically either unscrambles it and puts it in the log as incoming or you highlight what you type and press the hotkey and it automatically scrambles and sends it. I have the ActiveX for the hotkeys and such but I cant get the program working correctly without them first! Here is a screen of the interface.



This is the code I have written so far for it under the Encode button, obviously once I have that running I just flip the arrays for the decode so there is no point in me posting the whole thing. I will spre you all the 26 lines of me setting up the alphabet arrays because I cant figure out how to do a read/data in VB so it's 26 lines.

sl = Len(uinput.Text )
For x = 1 To sl
word2$(x) = Mid$(uinput, x, 1)
Next x
For x = 1 To sl
Print word2$(x); 'test to see if running so far
Next x
m = 0
Do Until w = sl
w = w + 1
For x = 1 To 26
If alpha$(x) = word2$(w) Then r = x
Next x
Log.Text = code$(r)
Loop



So basically it is supposed to break down the input into the array word2$. alpha$ is an array of the alphabet (1-26) and code$ is an array of random letters of the alphabet to produce the scramble. Now when I run this i get the print of whatever I'm putting in, but I get NO output into my "log" or output box. Now I'm pretty sure the way I have it set up it would only give me the last letter of my input in the box even if it did work, but I'm not even getting that.

HELP please??
Nov 22 '06 #1
2 3483
albertw
267 Contributor
Basically my friend's parents used to log his AIM and email so we made a barbaric version of an encoder that we could type in what we wanted and get random letters out. The only problem is that I did it in Truebasic, and I am new to VB. I have the interface layed out with an Encode button and a Decode button with an Input and an output/log. Eventually I want to have it just with universal hotkeys to where you can highlight a text and it automatically either unscrambles it and puts it in the log as incoming or you highlight what you type and press the hotkey and it automatically scrambles and sends it. I have the ActiveX for the hotkeys and such but I cant get the program working correctly without them first! Here is a screen of the interface.



This is the code I have written so far for it under the Encode button, obviously once I have that running I just flip the arrays for the decode so there is no point in me posting the whole thing. I will spre you all the 26 lines of me setting up the alphabet arrays because I cant figure out how to do a read/data in VB so it's 26 lines.

sl = Len(uinput.Text )
For x = 1 To sl
word2$(x) = Mid$(uinput, x, 1)
Next x
For x = 1 To sl
Print word2$(x); 'test to see if running so far
Next x
m = 0
Do Until w = sl
w = w + 1
For x = 1 To 26
If alpha$(x) = word2$(w) Then r = x
Next x
Log.Text = code$(r)
Loop



So basically it is supposed to break down the input into the array word2$. alpha$ is an array of the alphabet (1-26) and code$ is an array of random letters of the alphabet to produce the scramble. Now when I run this i get the print of whatever I'm putting in, but I get NO output into my "log" or output box. Now I'm pretty sure the way I have it set up it would only give me the last letter of my input in the box even if it did work, but I'm not even getting that.

HELP please??
hi

try this link

Alab

if you want the source, send me a mail
Nov 22 '06 #2
Killer42
8,435 Recognized Expert Expert
...Now I'm pretty sure the way I have it set up it would only give me the last letter of my input in the box even if it did work, but I'm not even getting that.
I haven't had time to go over the code thoroughly, but wher eyou have this
Expand|Select|Wrap|Line Numbers
  1. Log.Text = code$(r)
You can concatenate the text by using
Expand|Select|Wrap|Line Numbers
  1. Log.Text = Log.Text & code$(r)
Also, I'd suggest you look into functions such as Chr( ) and Asc( ) which should allow you to reduce your code somewhat by converting things more directly. For example, rather than looping through up to 26 array entries to find the number corresponding to a letter, you could use something like Asc(word$(x)) - 64 (the uppercase letters start at 65 in ASCII).
Nov 22 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
10204
by: Patrick | last post by:
Hello all! I am using a BufferedImage object to build an image from scratch. I want it to be a grayscale image with only 8bits of color. I have the color information as a byte, saved in variable name byte4. I have written the following code: First, thePanorama is defined as: new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Then I loop through like follows:
16
2454
by: Jim Hefferon | last post by:
Hello, I'm getting an error join-ing strings and wonder if someone can explain why the function is behaving this way? If I .join in a string that contains a high character then I get an ascii codec decoding error. (The code below illustrates.) Why doesn't it just concatenate? I'm building up a web page by stuffing an array and then doing "".join(r) at
7
17880
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm able to encrypt and then decrypt data okay as in the following code: // encrypt the data // Encryptor enc = new Encryptor(EncryptionAlgorithm.TripleDes); byte key = Encoding.ASCII.GetBytes("0123456789012345");
7
2675
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine if I use the web test interface. It also works fine if I call it from an ASP.NET page that has a text box where the XML is pasted and then passed on. However, I get an exception if I use an <input type="file"> control on the ASP page that allows...
0
1120
by: monfu | last post by:
Dear all I have the following code:- System.Drawing.Image src_image = System.Drawing.Image.FromStream(imgStream); Bitmap bitmap = new Bitmap(image_width, image_height, src_image.PixelFormat); Graphics new_g = Graphics.FromImage(bitmap);
28
3010
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. Ruby has ... an issue with docs. That is to say, there are almost none. Well, actually, there are some. For example, the "PickAxe" book (google it), and "Why's" Poignant Guide. But there's a disturbing lack of *built-in* docs for Ruby. Now, the...
4
19765
by: Amil | last post by:
I've upgraded to VS 2005. I have a page that contains no submit buttons...it merely shows some data. But, several times a day (out of thousands of hits), I get this error: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page...
8
5345
by: emailmygroup | last post by:
I am trying to decode character ‘#; but it is not working. Anybody knows how to decode this character?
7
4919
by: Mads Aggerholm | last post by:
Hello Sirs, I am having a BMP loadet into a picturebox. This I'd like to save on my harddisk as a GIF: picturebox1.Image.Save("C:\\DATA\\PICTURES\\testpic.gif", ImageFormat.Gif); However, this GIF-file is not in very good quality.
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10468
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.