我是想通過點擊一個按鈕,保存在硬盤驅動器上的列表中顯示的文件中的數據,但我不知道在山楂正確做到這一點:如何讀取文件並在VB.NET的列表框中顯示?
Private Sub btnListRecipes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListRecipes.Click
Dim TextLine As String
If System.IO.File.Exists(Filename) = True Then
Dim RecipeReader As New System.IO.StreamReader(Filename)
Do While RecipeReader.Peek() <> -1
TextLine = TextLine & RecipeReader.ReadLine() & vbNewLine
Loop
lstRecipes.Text = TextLine.Text
Else
MsgBox("File Does Not Exist")
End If
End Sub
我將是非常感激援助:d