"Formatted value of the cell has a wrong type" starts occuring after unrelated code change

  • Thread starter Thread starter primem0ver
  • Start date Start date
P

primem0ver

Guest
I had a major issue with Visual Studio Designer redesigning my DataGridView columns without me doing anything to cause it to do so due to a bug I have been experiencing lately. Now I have fixed that code, I have encountered another, almost completely aggravating problem for which I cannot find a cause. Before the incident described here it worked fine (and at this link if you are curious: https://social.msdn.microsoft.com/Forums/vstudio/en-US/58ad0b1f-a721-41fa-96ea-7c13a8fbd7f1/designer-completely-redesigned-my-datagridview-columns-without-my-consent?forum=vsarch)

I did absolutely NOTHING to change any other code in my project except to restore my original code in the Designer file using a file comparison tool and a 3 day old backup. Before the incident my code worked fine. Now I am experiencing a "Formatted value of the cell has a wrong type." error popup. Here is the one relevant section in the file that I had to restore that also gives some needed insight into the issue:

//
// AssignedCategory
//
this.AssignedCategory.DataPropertyName = "AssignedCategory";
this.AssignedCategory.DataSource = this.modCategoryBindingSource;
this.AssignedCategory.DisplayMember = "AssignedCategory";
this.AssignedCategory.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox;
this.AssignedCategory.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.AssignedCategory.HeaderText = "AssignedCategory";
this.AssignedCategory.Name = "AssignedCategory"; // THIS LINE HAD TO BE PUT BACK IN
// AssignedCategory is property of type ModCategory
this.AssignedCategory.ValueMember = "Self"; // THIS LINE ALSO HAD TO BE PUT BACK IN
this.AssignedCategory.Width = 200;

The two commented lines are the only ones related to my new problem at all. All the items in the combobox for this column are of Type "ModCategory". All of them display correctly except one which gives me the error. I don't understand why ONLY ONE would give a problem. I have ensured that it is part of the data set being used by the ComboBox. Is this ANOTHER bug?

Here is the code that creates the category that causes the warning box:

ModCategory current = ModCategory.CreateStaticCategory("Default Category", ModCategoryType.Null, ListPriority.Second);

The code then proceeds to assign five items to that particular category. Those five items cause the warning box to show when they scroll into view. I have no clue why it worked before and it doesn't now. As I stated, the only changes were to the designer code that I had to rebuild from the earlier issue; and only TWO lines have any connection to this issue at all. The "Default Category" is the same type as ALL OTHER categories that list just fine. So I am clueless as to what could be causing this error. Here is a screenshot of the warning/error box:

1603240.png

Continue reading...
 
Back
Top