Hello
The reading of a txt-file into a datagridview doesn't work quite well. The creating of the txt-file was no problem, only when I try to read the txt-file, VB.net gives the error "Path/File access error". This is the code:
Does anyone know how to solve this problem?
Thanks
The reading of a txt-file into a datagridview doesn't work quite well. The creating of the txt-file was no problem, only when I try to read the txt-file, VB.net gives the error "Path/File access error". This is the code:
VB.NET:
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
With SaveFileDialog1
.Filter = "Woordenlijst (*.txt)|*.txt|All files (*.*)|*.*"
.FilterIndex = 0
.InitialDirectory = "c:\Mijn documenten"
.Title = "Gegevens opslaan"
.ShowDialog()
End With
Dim intK As Integer
Dim bestand As String = SaveFileDialog1.FileName
intK = FreeFile()
FileOpen(intK, SaveFileDialog1.FileName, OpenMode.Output)
For i As Integer = 0 To 16
For j As Integer = 0 To 1
Print(intK, TblwoordenDataGridView.Rows(i).Cells(j).Value.ToString() & vbNewLine)
Next
Next
FileClose()
End Sub
Private Sub Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Open.Click
With OpenFileDialog1
.Filter = "Woordenlijst (*.txt|*.txt|All files (*.*)|*.*"
.FilterIndex = 0
.InitialDirectory = "c:\Mijn documenten"
.Title = "Gegevens laden"
.ShowDialog()
End With
Dim intK As Integer
intK = FreeFile()
FileOpen(intK, SaveFileDialog1.FileName, OpenMode.Input)
For i As Integer = 0 To 16
For j As Integer = 0 To 1
Print(intK, TblwoordenDataGridView.Rows(i).Cells(j).Value.ToString())
Next
Next
FileClose()
End Sub
Does anyone know how to solve this problem?
Thanks