|
-
Feb 3rd, 2004, 01:08 AM
#1
Thread Starter
Registered User
stopping the combo index changed event
I have an array list that I use as the datasource of a combobox. When I set the datasource of the combo equal to the arraylist, it triggers the combo index changed event once for every item in the array list.
Now usually this wouldn't matter but in this case as there is a sizeable amount of code that runs for the index changed event, I don't want this to happen.
My work around is a boolean for the event to run or not but this is ugly, is there any other way around this?
-
Feb 3rd, 2004, 01:54 AM
#2
Lively Member
try this
combo.items.addrange(arraylist)
with Regards
sameer Mulgaonkar

-
Feb 3rd, 2004, 02:33 AM
#3
Frenzied Member
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim employees() As String = New String() {"Hamilton, David", _
"Hensien, Kari", "Hammond, Maria", "Harris, Keith", _
"Henshaw, Jeff D.", "Hanson, Mark", "Harnpadoungsataya, Sariya", _
"Harrington, Mark", "Harris, Keith", "Hartwig, Doris", _
"Harui, Roger", "Hassall, Mark", "Hasselberg, Jonas", _
"Harnpadoungsataya, Sariya", "Henshaw, Jeff D.", "Henshaw, Jeff D.", _
"Hensien, Kari", "Harris, Keith", "Henshaw, Jeff D.", _
"Hensien, Kari", "Hasselberg, Jonas", "Harrington, Mark", _
"Hedlund, Magnus", "Hay, Jeff", "Heidepriem, Brandon D."}
ComboBox1.Items.Clear()
ComboBox1.Items.AddRange(employees)
ComboBox1.SelectedIndex = 0
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
MsgBox(ComboBox1.Items.Item(ComboBox1.SelectedIndex))
End Sub
I got it from MS. Works perfect.
-
Feb 3rd, 2004, 04:43 AM
#4
Thread Starter
Registered User
ok well I tried this
Me.ComboBox1.Items.AddRange(myArrayList)
but got this error:
arraylist cannot be converted to a one dimesional array.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|