I have a list box that I am trying to add data to from a txt file. I am doing this on two forms. The one form everything works the second form it does not.
text file: only the 7th line is add to the list box
Customer name:Coustomer name
Customer name:Job name
Customer name:8
Customer name:.375
Customer name:0
Customer name:1
1,B,30,30,12,1
end of cabinet list
1|B|12|30|1|R Side|1|0|0|0,0,0,0|0|1|1|1|0|0|0|0|0|.375
1|B|12|30|1|L Side|2|0|0|0,0,0,0|0|2|2|2|0|0|0|0|0|.375
1|B|12|28.5|1|Bottom|0|1|0|1,0,1,0|1|0|0|3|0|0|0|0|0|.375
1|B|6.5|28.5|2|Top|0|1|0|1,0,1,0|0|0|0|5|0|0|0|0|0|.375
1|B|28.5|28.5|1|Back|0|1|0|1,1,1,1|0|0|0|6|0|0|0|0|0|.375
1|B|10.5|28.5|2|Shelf|0|0|0|0,0,0,0|0|0|0|8|0|0|0|0|0|.375
when I load this into the list box I appear to split the line on the ,'s
The list box looks like this:
1
B
30
30
12
1
Code:
Public Sub Command1_Click()
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim whatfile As String
Dim cablist As String
whatfile = NoCollision.Tag
Open whatfile For Input As #1
For p = 0 To txtCoustomername.Count - 1
Line Input #1, Coustomername
Coustomername = Split(Coustomername, ":")
txtCoustomername(p).Text = Coustomername(1)
Next p
For l = 1 To txtCoustomername(4).Text - 1
Load P1(l)
P1(P1.Count - 1).Visible = True
Next l
''''''''''''''''''''''''
Do
Input #1, cablist
If cablist = "end of cabinet list" Then
'MsgBox "this is it"
Else
lstcabinets.AddItem (cablist)
End If
Loop Until cablist = "end of cabinet list"
''''''''''''''''''''
HScroll1.Max = txtCoustomername(4).Text
Do
i = 1 + i
Line Input #1, parts
part = Split(parts, "|")
For e = LBound(part) To UBound(part)
With optimizegrid
.TextMatrix(i, e) = part(e)
End With
Next e
optimizegrid.Rows = optimizegrid.Rows + 1
If optimizegrid.TextMatrix(i, 17) > "0" Then
Call optimizegrid_DblClick
i = 1 - i
End If
Loop Until EOF(1)
Close #1
What is happening?