|
-
Jan 1st, 2003, 01:38 PM
#1
Thread Starter
Addicted Member
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:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = UserName
txtnote.Text = password
UserName = TextBox1.Text
password = txtnote.Text
Dim Encrypt As String = ""
Dim letter As Char
Dim i, charsInFile As Short
Dim form1 As Form1
SaveFileDialog1.Filter = "Text files (*.txt)|*.txt"
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName <> "" Then
charsInFile = txtNote.Text.Length
For i = 0 To charsInFile - 1
letter = txtNote.Text.Substring(i, 1)
Encrypt = Encrypt & Chr(Asc(letter) + 1)
Next
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
PrintLine(1, Encrypt) 'copy text to disk
FileClose(1)
txtNote.Text = Encrypt
txtNote.Select(1, 0) 'remove text selection
TextBox1.Text = Encrypt
TextBox1.Select(1, 0)
End If
End Sub
Last edited by james14; Jan 1st, 2003 at 07:19 PM.
-
Jan 1st, 2003, 07:20 PM
#2
Thread Starter
Addicted Member
-
Jan 1st, 2003, 08:11 PM
#3
Sleep mode
Textbox1 and Txtnote textboxes are getting empty strings from UserName and Password variables. So ,just leave out these lines and it will save the text .
VB Code:
'delete this
TextBox1.Text = UserName
Txtnote.Text = Password
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
|