Hi jonny,
Kann ich ein FlexGrid direkt zeilenweise auslesen ?
if not EOF +1?
nein, das Flexgrid ist doch kein File.
Das könnte etwa so aussehen:
Private Sub Command1\_Click()
Dim Datei As String, ff As Integer
Dim r As Long, c As Long, Zl As String
ff = FreeFile
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #ff
Print #ff, MSFlexGrid1.Rows
Print #ff, MSFlexGrid1.Cols
For r = 1 To MSFlexGrid1.Rows - 1
Zl = ""
For c = 0 To MSFlexGrid1.Cols - 1
Zl = Zl + MSFlexGrid1.TextMatrix(r, c) + "|"
Next
Print #ff, Zl
Next
Close #ff
End Sub
Private Sub Command2\_Click()
Dim Datei As String, ff As Integer
Dim r As Long, c As Long, Zl As String, Feld() As String
ff = FreeFile
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #ff
Input #ff, r
Input #ff, c
MSFlexGrid1.Rows = r
MSFlexGrid1.Cols = c
For r = 1 To MSFlexGrid1.Rows - 1
Input #ff, Zl
Feld = Split(Zl, "|")
For c = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.TextMatrix(r, c) = Feld(c)
Next
Next
Close #ff
End Sub
Gruß Rainer