我想打开我的 .txt 文件,但出现此错误
错误 1 未声明“打开”。文件 I/O 功能通常在“Microsoft.VisualBasic”命名空间中可用,但目标平台不支持它。
我正在使用 vb2010,我认为代码是错误的,因为它适用于 vb6。如何将其更改为在vb2010中工作?
Private Sub zapisz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zapisz.Click
Open "C:\Plik.txt" For Append As #1 'zapis
print #1, "a" & a.Text
Print #1, "b" & b.Text
Print #1, "c" & c.Text
Print #1, "d" & d.Text
Close #1
End Sub
Private Sub wczytaj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wczytaj.Click
Dim strText As String, strIndex As String
Open "C:\Plik.txt" For Input As #1
Do Until EOF(1)
Input #1, strText
strIndex = Left(strText, 1)
strText = Right(strText, Len(strText) - 1)
Select Case strIndex
Case "a" : a = strText
Case "b" : b = strText
Case "c" : c = strText
Case "d" : d = strText
End Select
Loop
Close #1
End Sub