Imports System.IO Public Class Form1 Const CryptoKey As String = "StefanHutterUnternehmensberatung8808Pfaeffikon" Private Sub LadenToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles LadenToolStripMenuItem1.Click If OpenFileDialog1.ShowDialog = DialogResult.OK Then Read_File(OpenFileDialog1.FileName, False) End If End Sub Private Sub LadenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LadenToolStripMenuItem.Click If OpenFileDialog1.ShowDialog = DialogResult.OK Then Read_File(OpenFileDialog1.FileName, True) End If End Sub Private Sub Read_File(ByVal filename As String, ByVal Crypted As Boolean) Dim reader = File.OpenText(filename) Me.TextBox1.Text = "" Dim line As String = Nothing Dim lines As Integer = 0 Dim i = 0 While (reader.Peek() <> -1) line = reader.ReadLine() If Crypted Then line = Crypto.DecryptText(line, CryptoKey) End If If i > 0 Then Me.TextBox1.AppendText(vbCrLf) i = i + 1 Me.TextBox1.AppendText(line) End While reader.Close() End Sub Private Sub SpeichernToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles SpeichernToolStripMenuItem1.Click If SaveFileDialog1.ShowDialog = DialogResult.OK Then save_file(SaveFileDialog1.FileName, False) End If End Sub Private Sub SpeichernToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpeichernToolStripMenuItem.Click If SaveFileDialog1.ShowDialog = DialogResult.OK Then Save_File(SaveFileDialog1.FileName, True) End If End Sub Private Sub Save_File(ByVal Filename As String, ByVal Crypted As Boolean) Dim file As System.IO.StreamWriter file = My.Computer.FileSystem.OpenTextFileWriter(Filename, False) For i = 0 To Me.TextBox1.Lines.Count - 1 Dim s As String s = Me.TextBox1.Lines(i) If Crypted Then s = Crypto.EncryptText(s, CryptoKey) file.WriteLine(s) Next file.Close() End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub End Class