C# Winforms DatagridviewCombobox exception String cannot be converted to class -


I am experiencing an exception Detagrivid scene (dropdown menu) and choose a new value from the control embedded in Detagrid Views is done. Combobox is populated by a binding source, which is populated with examples of my class. I can display options in the menu properly, and select one, but changing the focus to change a new control (I think to change that) causes an exception to appear: the system Invalid cast from String stack trace myclass (if I'm correct use of the word) source shows

System.Windows.Forms.DataGridView.PushFormattedValue cascading down System.Convert.DefaultToType < p> another obvious explanation below (the long regret, but I wanted to reproduce it):

I also have an empty class called Apupent, no properties ( The problem occurs when migrant is also a string name property, this New is not it). I have a binding source that is called occupateness source, pointing to people living with its datasource.

I am also called a car, which has a migrant property named Driver.

I do in my Form_lod (), I call Okyupantssors.adanu () to extend the call twice, once CarSource.AddNew ().

I have a Datagreed visual control, which Detasors is CarSource (binding source consisting of the cars) is a column near Dijivi, which displays driver estate cars Karrsor. This is a datagridclobbox column, in which a driver named Dataproopernet is set up.

So what I want is to show the rows of cars Detagrid Vijhuars, a column I could drop down with a Kangiboksi can choose drivers from the current drivers have occupied but I Exceptions get.

Is this something wrong? Can not you use a class examples to populate a Data Grid Vib ComboBex?

My head was scratching, trying to solve it using my google-fu For hours. This link ultimately gave me a good explanation.

The way I decide it, it was to change DisplayMember. I knew about 'Self' who had returned 'this' - I was using it for both DisplayMember and ValueMember, thinking it would only doostring the property from the performer.

Reading your explanation, maybe you do not have DisplayMember and ValueMember set? If this is the case, then try to set them up properly (and do not use the 'this' reference for the display member!) And it can fix it.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -