Zdravim. Zatial sa mi nepodarilo prist na to, ako zapisovat z richtextboxu do txt suboru vzdy do noveho riadku po stlaceni button. Na konci by mali zostat vsetky zadane hodnoty ulozene v txt subore v riadkoch. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim p As Integer
p = Label6.Text
Label6.Text = p + 1
Dim write As New System.IO.StreamWriter("C:\priklad.txt")
If p = 1 Then write.Write(RichTextBox1.Text + ControlChars.NewLine)
write.Close()
Dim read As New System.IO.StreamReader("C:\priklad.txt")
TextBox1.Text = read.ReadLine()
read.Close()
Dim write2 As New System.IO.StreamWriter("C:\priklad.txt")
If p = 2 Then write2.WriteLine(RichTextBox1.Text + ControlChars.NewLine)
write2.Close()
Dim read2 As New System.IO.StreamReader("C:\priklad.txt")
TextBox2.Text = read2.ReadLine()
read2.Close()
Dim write3 As New System.IO.StreamWriter("C:\priklad.txt")
If p = 3 Then write3.WriteLine(RichTextBox1.Text + ControlChars.NewLine)
write3.Close()
Dim read3 As New System.IO.StreamReader("C:\priklad.txt")
TextBox3.Text = read3.ReadLine()
read3.Close()
Dim write4 As New System.IO.StreamWriter("C:\priklad.txt")
If p = 4 Then write4.WriteLine(RichTextBox1.Text + ControlChars.NewLine)
write4.Close()
Dim read4 As New System.IO.StreamReader("C:\priklad.txt")
TextBox4.Text = read4.ReadLine()
read4.Close()
Dim write5 As New System.IO.StreamWriter("C:\priklad.txt")
If p = 5 Then write5.WriteLine(RichTextBox1.Text + ControlChars.NewLine)
write5.Close()
Dim read5 As New System.IO.StreamReader("C:\priklad.txt")
TextBox5.Text = read5.ReadLine()
read5.Close()
End Sub
|