Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
on combobox i have bind intger in value memeber but when i am using it
C#
int a= Convert.ToInt32(combobox.selectedValue);

it show me error that cannot covert object to iconvertable
Posted

1 solution

And it can't.
The SelectedValue property of a ComboBox returns an object, the actual type of which depends on what type of objects you loaded the Items collection with.

By the sounds of it, you have loaded a type which does not implement the IConvertable interface: have you tried:
C#
int a = Convert.ToInt32(combobox.selectedValue.ToString());
It should work: but it would probably be better to cast the value to the actual type you loaded in the first place!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900