lumin
Jan 19th, 2000, 07:30 AM
Please help me with this problem.
Some How I can't get this code to work.
It works great when I only use 1 Array Element Group but when I use 2 I get a runtime error 340 and a message that says: "Control Array Element '1' Doesent exist"
Public iNumOfOperator As Integer
Public iNumOfOwner As Integer
Private Sub Form_Load()
iNumOfOwner = 1
iNumOfOperator = 9
Dim sFile As String
Dim iTextbox As Integer
On Error GoTo NoFile
With cdbLoadSave
.DialogTitle = "Open User Configuration.."
.Filter = "Usr File (.Usr)|*.usr"
.CancelError = True
.ShowOpen
sFile = .FileName
End With
On Error GoTo 0
Open sFile For Input As 1
While Not EOF(1)
Line Input #1, sFile
If Left(sFile, 6) = "[Owner" Then
iTextbox = Val(Trim(Mid(sFile, 7, InStr(sFile, "]") - 1)))
txtOwner(iTextbox) = ""
Else
txtOwner(iTextbox) = txtOwner(iTextbox) & sFile & vbCrLf
End If
If Left(sFile, 9) = "[Operator" Then
iTextbox = Val(Trim(Mid(sFile, 10, InStr(sFile, "]") - 1)))
txtOperator(iTextbox) = ""
Else
txtOperator(iTextbox) = txtOperator(iTextbox) & sFile & vbCrLf
End If
Wend
Close 1
NoFile:
End Sub
If you can Help me that would be great.
Thanks anyway.
-Lumin
Some How I can't get this code to work.
It works great when I only use 1 Array Element Group but when I use 2 I get a runtime error 340 and a message that says: "Control Array Element '1' Doesent exist"
Public iNumOfOperator As Integer
Public iNumOfOwner As Integer
Private Sub Form_Load()
iNumOfOwner = 1
iNumOfOperator = 9
Dim sFile As String
Dim iTextbox As Integer
On Error GoTo NoFile
With cdbLoadSave
.DialogTitle = "Open User Configuration.."
.Filter = "Usr File (.Usr)|*.usr"
.CancelError = True
.ShowOpen
sFile = .FileName
End With
On Error GoTo 0
Open sFile For Input As 1
While Not EOF(1)
Line Input #1, sFile
If Left(sFile, 6) = "[Owner" Then
iTextbox = Val(Trim(Mid(sFile, 7, InStr(sFile, "]") - 1)))
txtOwner(iTextbox) = ""
Else
txtOwner(iTextbox) = txtOwner(iTextbox) & sFile & vbCrLf
End If
If Left(sFile, 9) = "[Operator" Then
iTextbox = Val(Trim(Mid(sFile, 10, InStr(sFile, "]") - 1)))
txtOperator(iTextbox) = ""
Else
txtOperator(iTextbox) = txtOperator(iTextbox) & sFile & vbCrLf
End If
Wend
Close 1
NoFile:
End Sub
If you can Help me that would be great.
Thanks anyway.
-Lumin