Jména
Imports
System
Imports System.io
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Listbox1.Items.clear() End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ListBox1.Items.Add("Josef Novák")
ListBox1.Items.Add("Karel Dvořák")
ListBox1.Items.Add("Hugo Konzerva")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim fw As StreamWriter
fw = New StreamWriter("Seznam.txt")
fw.WriteLine(ListBox1.Items.Count) For i = 0 To ListBox1.Items.Count - 1
fw.WriteLine(ListBox1.Items.Item(i)) Next
fw.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim fr As StreamReader
Dim pocet As Integer
Dim i As Integer
ListBox1.Items.Clear()
fr = New StreamReader("Seznam.txt")
pocet = fr.ReadLine() For i = 0 To pocet - 1
ListBox1.Items.Add(fr.ReadLine()) Next
fr.Close()
End Sub
End Class