|
-
Feb 11th, 2003, 10:13 AM
#1
Thread Starter
New Member
Objects in combobox
Hi!
I am working with a windows form containing a combobox (cboSchools). In the combobox I want to display a list of schools. But I want each item in the combobox to contain a little more information than only the name of the school, therefor I populate the combobox with objects of type clsSchool, a class containing name of school, id etc. Populating the combobox is no problem. With a ToString function in the clsSchool class the names of the schools are shown in the combobox.
Then I want to retreive the object that the user has selected. But Me.cboSchool.SelectedItem will return a object of type System.Object and not of type clsSchool, and thus I cannot reach the properties defined in clsSchool.
So the question is: How can I make my objects in the combobox recognised as beeing of type clsSchool? Is there some way of setting the default type of items in a combobox to something else than System.Object? Or does anyone know another way of solving this?
Thankful for any help!
/Sara
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
|