我试图通过单击按钮在保存在硬盘驱动器上的列表中显示文件中的数据,但是我不确定如何正确执行此操作:
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