VB Help with crypto program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yabighelen
    New Member
    • Mar 2008
    • 1

    #1

    VB Help with crypto program

    HELP!!!!!

    I have to write a program that does this:

    Create a program that encrypts and decrypts a message...

    Inputs: A typed message

    Output: When the encrypt button is clicked the input message is encrypted. When the Decrypt button is clicked, the message is decrypted.

    the encrypted button is clicked...this adds 1 to the ASCII value of a letter; therefore, if the word "Hello" is typed into the textbox, the letters "Ifmmp" would be displayed in the encrypt text box. The Decrypt button reverses the process by subtracting 1 from the ASCII value.

    Additional Info: The program should include encrypt message, decrypt message, clear and exit buttons. their functionality is as follows:

    The encrypt message button takes the message button takes the message entered into the first textbox. It then breaks the message down into its individual letters and converts it to ASCII. Once that is done, it adds one to the ASCII value and displays it in the second textbox.

    The code to declare a char array and store the values from the first textbox is as follows:

    Dim chrArray(() As Char = txtMessage.Text .ToCharArray

    You will use a For Next loop to process every letter in the message. You will use 0 for the lower bound and chrArray.GetUpp erBound(0) for the upper bound.

    You will use the chr() and asc() functions to find the next higher ASCII value. Chr(Asc(chrArra y(intCount)) + )

    Once the new ASCII value is found, display it in the second textbox.

    The dexrypt message button takes the encrypted message in the second textbox. It then breaks the message down into its individual letters and converts it to the third textbox.

    When the Clear button is clicked, the program should clear data out of all 3 textboxes.

    When the Exit button is clicked, the program should terminate.


    The program should use error handling and display a message box containing the following text "ID10T Error" when an error is encountered.

    Comments should be used to document how the program functions.

    Evaluation Criteria:

    1) All labels, textboxes and command button display the correct cation
    2) The listbox and command buttons names use proper Hungarian notation and camel casing
    3) The exit button terminates the program
    4) The sclear button clears all textbox data before any new data is added
    5) The encrypt message button correctly encrypts the input message
    6) The decrypt message button correctly decrypts the encrypted message
    7) Error handling functions correctly
    8) Comments are used to document processing
    9) Message box functions correctly
    10) All text data is converted to the appropiate type

    Heres what I have so far.....
    [code=vbnet]
    Public Class Form1

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s)
    Handles Button1.Click
    Dim strArray() As String + txtInput.Text.S plit(",")
    Dim intHold As Integer
    Dim intX As Integer
    Dim intY As Integer
    Dim inArray(strArra y.GetUpperBound (0)) As Integer
    For intCount As Integer = 0 To strArray.GetUpp erBound(0)
    intArray(intCou nt) = CType(strArray( intCount), Integer

    Next

    'sort
    For intX = 0 To intArray.GetUpp erBound(0)
    For intY = 0 to intArray.GetUpp erBound(0)
    If intArray(intX) < intArray(intY) Then
    intHold = intArray(intY)
    intArray(intY) = intArray(intX)
    intArray(intX) = intHold
    End If
    Next
    Next

    Dim strOutput As String = ""
    For Each strItem As String In strArray
    strOutput & ","
    Next

    txtOutput.Text = strOutput.Trim( ",")
    Next
    End Sub
    End Class[/code]
    Something isn't right and I don't know what to do....By this what should the names of the buttons and boxes be....maybe I have that wrong? What would make it work?

    Help me PLEASE>>>>

    Angi Nelson

    removed mail id
    Last edited by debasisdas; Mar 17 '08, 06:18 AM. Reason: added code=vbnet tags and removed mail id
Working...