That makes sense. I need to be able to bind it to a user defined
collection. I have six combo boxes. The first one loads when the form
opens, and then the others load depending on the user choice in the
first box. What I did was is just manually load the box. Then it isn't
bound and doesn't automatically pick the first item. I would rather be
able to bind it like the others though.
Thank you for your help and input, I really appreciate it. Sometimes
it's nice just to know I'm not the only one it doesn't work right for.
/**** CODE STARTS HERE ****/
Friend Function LoadCategories(ByRef DropDown As ComboBox) As
CategoryCollection
'Written(By) : KTuel
'Parameters: DropwDown - A combobox to be filled with the
categories
'
'Task: Load all product categories
'
'Revision(History)
'02/09/2005 - Created kTuel
Dim CategoryServer As New CategoryServer
Dim Categories As CategoryCollection
Categories = CategoryServer.LoadAllCategories()
'.NET has a bug in MDI applications that when a combo box is
bound to a source and
'the combobox is populated in the load event of a child form,
you can't set the
'selectedindex to -1. Here we are populating the combobox
without binding it
Dim Category As Category
If Categories.Count > 0 Then
DropDown.SuspendLayout()
For Each Category In DirectCast(Categories,
IDictionary).Values()
DropDown.Items.Add(Category)
Next Category
DropDown.DisplayMember = "Name"
DropDown.ValueMember = "ID"
DropDown.SelectedIndex = -1
DropDown.SelectedIndex = -1
DropDown.ResumeLayout()
End If
Return Categories
End Function
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!