Hello everybody.
As a new member to vb6, I need your help to ajust a code that will transfer all grid data to a .dat file.
Now, what's missing and i dont now how to do it is:
msflexgrid exemple:
Column 1 line 1 of Grid = "H"
Column 2 line 1 of Grid = "A"
Column 3 line 1 of Grid = "HOST"
Column 4 line 1 of Grid = "08989" etc.
Position in the .dat file:
Column 1 line 1 of Grid = Position 1
Column 2 line 1 of Grid = Position 2
Column 3 line 1 of Grid = Position 3
Column 4 line 1 of Grid = Position 9.
At the end, the result would be
"HAHOST 08989"
How can i do this please?
Thanks again
As a new member to vb6, I need your help to ajust a code that will transfer all grid data to a .dat file.
Code:
Dim MyFreeFile As Integer
Dim icol As Integer
Dim irow As Integer
Dim MyString As String
MyFreeFile = FreeFile
Open "C:\Documents and Settings\All Users\Desktop\ord" For Output As MyFreeFile
For irow = 1 To MSFlexGrid1.Rows - 1 'Start from top to bottom
For icol = 0 To MSFlexGrid1.Cols - 1 'Start from left to Right
MyString = MyString & MSFlexGrid1.TextMatrix(irow, icol) & _
IIf((icol = MSFlexGrid1.Cols - 1), "", ",") 'Add value in mystring for each column in Flexgrid
Next
Print #MyFreeFile, MyString 'Print to notepad
MyString = "" 'Reset MyString
Next
Close MyFreeFile
msflexgrid exemple:
Column 1 line 1 of Grid = "H"
Column 2 line 1 of Grid = "A"
Column 3 line 1 of Grid = "HOST"
Column 4 line 1 of Grid = "08989" etc.
Position in the .dat file:
Column 1 line 1 of Grid = Position 1
Column 2 line 1 of Grid = Position 2
Column 3 line 1 of Grid = Position 3
Column 4 line 1 of Grid = Position 9.
At the end, the result would be
"HAHOST 08989"
How can i do this please?
Thanks again
Comment