sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
amitjaura's Avatar

Use if IListSource for binding of combobox to the collection


Question posted by: amitjaura (Newbie) on August 27th, 2008 10:15 AM
Now I am stuck at a point where I want to bind combobox with datasource.The coding I tried is:::::::::::::

BusLayer.Surgeon objsurgeon = new BusLayer.Surgeon();
BusLayer.SurgeonCollection surgeonCollection;
surgeonCollection = objsurgeon.GetSurgeonCollection();

cmbChiefSurgeon.DataSource = surgeonCollection.Collection(); cmbChiefSurgeon.ValueMember = "doctorName";
cmbAssistantSurgeon1.DisplayMember = "doctorName";


But in the bolded line it is showing error that we have to use IListSource..I know that it is an interface but don't know anything much about this...Please sort out this problem.........
3 Answers Posted
amitjaura's Avatar
amitjaura August 27th, 2008 02:13 PM
Newbie - 14 Posts
#2: Re: Use if IListSource for binding of combobox to the collection

please reply some one
insertAlias's Avatar
insertAlias August 27th, 2008 02:31 PM
Moderator - 1,874 Posts
#3: Re: Use if IListSource for binding of combobox to the collection

Please don't bump your threads so quickly.

Try to remember that this is an international forum and that the Experts are spread across several time zones. We expect you to bump your thread only once every 24 hours.

Bumping more often will take attention away from other members and is seen as selfish and rude.

MODERATOR
cloud255's Avatar
cloud255 August 27th, 2008 02:49 PM
Expert - 199 Posts
#4: Re: Use if IListSource for binding of combobox to the collection

Well, if it wants you to use an IList object, i guess you have to either change your surgeon collection to be a list, or you have to create a new list, fill it with the items from the collection and use the list as the datasource, i suppose the second approach would require the least amount of work.

Ah, i found another approach, you declare a list and make it equal to your collection with the following code:

Expand|Select|Wrap|Line Numbers
  1. collection.ToList<Type>()


again you would have to cast back before going to the DB.
Reply
Not the answer you were looking for? Post your question . . .
197,034 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,034 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top .NET Contributors