Imports System.IO
Public Class Form1
Dim radek As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Using reader As StreamReader = New StreamReader("soubor.txt") 'otevre soubor
While radek <> Nothing 'dokud radek ma nejakou hodnotu..
radek = reader.ReadLine() '..tak se mu vzdy priradi dalsi radek
ListView1.Items.Add(radek) 'a prida se do listview
End While
reader.Close()
End Using
End Sub
End Class
no tak snad to je takhle spravne.. Jinak to While tam je oač Streamreader cte dal, a kdyz uz nema dalsi radek, vraci hodnotu Nothing, a to by ti vypsalo chybu, ptž nemužeš Nothing pridat do listview..
|