T
Thomas Beyerlein
I am writing code for a list box editor, one of the lists is large was
hoping that there is a way to either speed it up by making the server do
the IF statements of there is a faster way of checking the lists? Any
help would be useful. Have posted the code I am using below
Tom
parentControl = New Windows.Forms.ListBox
parentControl = control
table = sourceTable
column = field
' populate right list box
For i = 0 To control.Items.Count - 1 Step 1
lstDestination.Items.Add(control.Items.Item(i))
Next
' populate left list box
tempString = "SELECT " & field & " FROM " & sourceTable
myDataSet = Q.Query(tempString)
For i = 0 To myDataSet.Tables("myData").Rows.Count - 1 Step 1
' add to box only if it does not have that item already
If
lstDestination.Items.Contains(myDataSet.Tables("myData").Rows(i).Item(fi
eld)) = False Then
lstSource.Items.Add(myDataSet.Tables("myData").Rows(i).Item(field))
End If
Next
hoping that there is a way to either speed it up by making the server do
the IF statements of there is a faster way of checking the lists? Any
help would be useful. Have posted the code I am using below
Tom
parentControl = New Windows.Forms.ListBox
parentControl = control
table = sourceTable
column = field
' populate right list box
For i = 0 To control.Items.Count - 1 Step 1
lstDestination.Items.Add(control.Items.Item(i))
Next
' populate left list box
tempString = "SELECT " & field & " FROM " & sourceTable
myDataSet = Q.Query(tempString)
For i = 0 To myDataSet.Tables("myData").Rows.Count - 1 Step 1
' add to box only if it does not have that item already
If
lstDestination.Items.Contains(myDataSet.Tables("myData").Rows(i).Item(fi
eld)) = False Then
lstSource.Items.Add(myDataSet.Tables("myData").Rows(i).Item(field))
End If
Next