The following code loads a sequential .txt file into an msflexgrid once a the second is clicked. The code for adding is correct. However it loads the file twice for some reason ? How do make it to display once ? Any suggestions ?
[CODE=vb]Private Sub tabAdmin_Click( PreviousTab As Integer)
If tabAdmin.Tab = 1 Then
Open App.Path & "\deliveries.tx t" For Input As #12
Dim oldRow As Long
Dim lngRow As Long
Dim lngCol As Long
Dim strID As String
Dim strPickupName As String
Dim strPickupAdd As String
Dim strPickupTel As String
Dim strDelName As String
Dim strDelAdd As String
Dim strDelTel As String
Dim strWoP As String
Dim strDelPrice As String
Dim strPriority As String
Dim strPickupDate As String
Dim strDelDate As String
counter = 1
Do Until EOF(12)
Input #12, strPickupName, strPickupAdd, strPickupTel, strDelName, strDelAdd, strDelTel, strWoP, strDelPrice, strPickupDate, strDelDate
MSFlexGrid1.Tex tMatrix(counter , 0) = ""
MSFlexGrid1.Tex tMatrix(counter , 1) = strPickupName
MSFlexGrid1.Tex tMatrix(counter , 2) = strPickupAdd
MSFlexGrid1.Tex tMatrix(counter , 3) = strPickupTel
MSFlexGrid1.Tex tMatrix(counter , 4) = strDelName
MSFlexGrid1.Tex tMatrix(counter , 5) = strDelAdd
MSFlexGrid1.Tex tMatrix(counter , 6) = strDelTel
MSFlexGrid1.Tex tMatrix(counter , 7) = strWoP
MSFlexGrid1.Tex tMatrix(counter , 8) = strDelPrice
MSFlexGrid1.Tex tMatrix(counter , 9) = strPickupDate
MSFlexGrid1.Tex tMatrix(counter , 10) = strDelDate
MSFlexGrid1.Row s = MSFlexGrid1.Row s + 1
For lngRow = MSFlexGrid1.Row s - 2 To MSFlexGrid1.Row Step -1
For lngCol = 0 To MSFlexGrid1.Col s - 1
MSFlexGrid1.Tex tMatrix(lngRow + 1, lngCol) = MSFlexGrid1.Tex tMatrix(lngRow, lngCol)
If lngRow = MSFlexGrid1.Row Then
MSFlexGrid1.Tex tMatrix(lngRow, lngCol) = "" 'Make the current row empty
End If
Next
Next
Loop
Close #12
End If
End Sub[/CODE]
[CODE=vb]Private Sub tabAdmin_Click( PreviousTab As Integer)
If tabAdmin.Tab = 1 Then
Open App.Path & "\deliveries.tx t" For Input As #12
Dim oldRow As Long
Dim lngRow As Long
Dim lngCol As Long
Dim strID As String
Dim strPickupName As String
Dim strPickupAdd As String
Dim strPickupTel As String
Dim strDelName As String
Dim strDelAdd As String
Dim strDelTel As String
Dim strWoP As String
Dim strDelPrice As String
Dim strPriority As String
Dim strPickupDate As String
Dim strDelDate As String
counter = 1
Do Until EOF(12)
Input #12, strPickupName, strPickupAdd, strPickupTel, strDelName, strDelAdd, strDelTel, strWoP, strDelPrice, strPickupDate, strDelDate
MSFlexGrid1.Tex tMatrix(counter , 0) = ""
MSFlexGrid1.Tex tMatrix(counter , 1) = strPickupName
MSFlexGrid1.Tex tMatrix(counter , 2) = strPickupAdd
MSFlexGrid1.Tex tMatrix(counter , 3) = strPickupTel
MSFlexGrid1.Tex tMatrix(counter , 4) = strDelName
MSFlexGrid1.Tex tMatrix(counter , 5) = strDelAdd
MSFlexGrid1.Tex tMatrix(counter , 6) = strDelTel
MSFlexGrid1.Tex tMatrix(counter , 7) = strWoP
MSFlexGrid1.Tex tMatrix(counter , 8) = strDelPrice
MSFlexGrid1.Tex tMatrix(counter , 9) = strPickupDate
MSFlexGrid1.Tex tMatrix(counter , 10) = strDelDate
MSFlexGrid1.Row s = MSFlexGrid1.Row s + 1
For lngRow = MSFlexGrid1.Row s - 2 To MSFlexGrid1.Row Step -1
For lngCol = 0 To MSFlexGrid1.Col s - 1
MSFlexGrid1.Tex tMatrix(lngRow + 1, lngCol) = MSFlexGrid1.Tex tMatrix(lngRow, lngCol)
If lngRow = MSFlexGrid1.Row Then
MSFlexGrid1.Tex tMatrix(lngRow, lngCol) = "" 'Make the current row empty
End If
Next
Next
Loop
Close #12
End If
End Sub[/CODE]
Comment