Results 1 to 3 of 3

Thread: encrypt, save

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    216

    encrypt, save

    In my book that i got with vb.net there was this little code on encrypting text and saving it, when i moved it over to my code and program it didnt save the text. It loads it up but there is no text in the textbox. Why doesnt it save the actual text? ill post a code here in a sec.

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         TextBox1.Text = UserName
    3.         txtnote.Text = password
    4.         UserName = TextBox1.Text
    5.         password = txtnote.Text
    6.         Dim Encrypt As String = ""
    7.         Dim letter As Char
    8.         Dim i, charsInFile As Short
    9.         Dim form1 As Form1
    10.  
    11.         SaveFileDialog1.Filter = "Text files (*.txt)|*.txt"
    12.         SaveFileDialog1.ShowDialog()
    13.         If SaveFileDialog1.FileName <> "" Then
    14.               charsInFile = txtNote.Text.Length
    15.             For i = 0 To charsInFile - 1
    16.                 letter = txtNote.Text.Substring(i, 1)
    17.                      Encrypt = Encrypt & Chr(Asc(letter) + 1)
    18.             Next
    19.             FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
    20.             PrintLine(1, Encrypt) 'copy text to disk
    21.             FileClose(1)
    22.             txtNote.Text = Encrypt
    23.             txtNote.Select(1, 0)   'remove text selection
    24.             TextBox1.Text = Encrypt
    25.             TextBox1.Select(1, 0)
    26.         End If
    27.             End Sub
    Last edited by james14; Jan 1st, 2003 at 07:19 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width