Issue with loop vb6

wilder1926
08-26-2009, 08:41 AM
Hello everybody,

I'm new to this forum and I'm also new to VB6.

I need your help with one loop thread.

In my code, in Combo4, I have a list of number. Now, what I want to do is that one at the time, it will transfer the number with is detail from other Combo and Text, after it will pass through the next number in the Combo4, and so on, until there is now more number at the end of the list.

What my code do at this moment, event if the combo4 have no value, it still do the loop up to 198. But in my list, I have only 84 number.

Could you help me please?

Thanks

Here is my code:
Private Sub Command4_Click()
Do Until Combo4.ListIndex = Combo4.ListCount - 1

'insert code
MSFlexGrid1.ColWidth(0) = 1500
MSFlexGrid1.AddItem "H" & vbTab & Combo1.Text & vbTab & "M" & Combo7 & "00" & Text2 & vbTab & Combo2 & vbTab & "HOST" & vbTab & Combo3 & vbTab & Combo4 & vbTab & vbTab & vbTab & Text10 & vbTab & Text11 & vbTab & Text12 & vbTab & Text13 & vbTab & Combo5 & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "COL" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "M" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "P" & vbTab & vbTab & "M" & Combo7 & "00" & Text2 & vbTab & Combo2 & vbTab & Text16 & vbTab & Text14 & vbTab & Text9 & vbTab & vbTab & vbTab & vbTab & Combo6

'augmanter le nombre de commande
Text5 = Text5 + 1

FlexGrid_AutoSizeColumns MSFlexGrid1, Me

Text2 = Text2 + 1

'next orders
Combo4.ListIndex = Combo4.ListIndex + 1

Frame2.Visible = True
MSFlexGrid1.Visible = True


'Insert pieces and cubes for the store
Dim i As Integer
For i = 0 To Order_LakeShore.MSFlexGrid1.Rows - 1
If New_order.Combo4.Text = Order_LakeShore.MSFlexGrid1.TextMatrix(i, 1) Then
'MsgBox "Found: " & Order_LakeShore.MSFlexGrid1.TextMatrix(i, 1) & ": " & Order_LakeShore.MSFlexGrid1.TextMatrix(i, 21)
Text9.Text = Order_LakeShore.MSFlexGrid1.TextMatrix(i, 20)
Text16.Text = Order_LakeShore.MSFlexGrid1.TextMatrix(i, 21)
Text4.Text = Order_LakeShore.MSFlexGrid1.TextMatrix(i, 22)
Label18 = Order_LakeShore.MSFlexGrid1.TextMatrix(i, 0)
End If
Next

'Insert windows for the store
Dim j As Integer
For j = 0 To LakeShore.MSFlexGrid1.Rows - 1
If New_order.Combo4.Text = LakeShore.MSFlexGrid1.TextMatrix(j, 0) Then
'MsgBox "Found: " & Order_LakeShore.MSFlexGrid1.TextMatrix(j, 1) & ": " & Order_LakeShore.MSFlexGrid1.TextMatrix(i, 21)
Text10.Text = Text3 & Text6 & Text14 & LakeShore.MSFlexGrid1.TextMatrix(j, 2)
Text11.Text = Text3 & Text6 & Text14 & LakeShore.MSFlexGrid1.TextMatrix(j, 3)
Text12.Text = Text3 & Text6 & Text14 & LakeShore.MSFlexGrid1.TextMatrix(j, 2)
Text13.Text = Text3 & Text6 & Text14 & LakeShore.MSFlexGrid1.TextMatrix(j, 3)


End If
Next

Loop

End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum