Click here to Skip to main content
14,773,758 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am somewhat new to VB.NET so please bare with me on this.

I have a DataGridView on a form that I am using to edit data.

The DataGridView has a couple of CheckBox Columns and a couple of ComboBox Columns.

I populate the ComboBox Columns with data that the user can select from.

The problem that I am having is when I select an item from the Dropdown list of the ComboBox, and tab off the Column, I get a Formatting Display Error!

Please be aware that the DataGridView is not bound to any data. I am just populating the cells from my Class.

Maybe there might be a way to populate the DataGridView from the Class directly, but I guess that could be a topic for another discussion.

Please advise

THank you

Gary

What I have tried:

Everything that I could think of!
Posted
Updated 14-Dec-20 7:54am
Comments
CHill60 14-Dec-20 9:58am
   
What is the error? Precisely. What code if any, do you have on any of the events that might be fired by leaving the cell or column?
gary hagerty 14-Dec-20 11:58am
   
Hello Sir,

Thank you for your reply.

I trap for errors using the DataError event where I have the following line of code:

MessageBox.Show("Error happened " + e.Context.ToString())

and get back the message:

Error Happened Formatting, Display.

I do not have any code on any events that would get fired as a result of tapping off the ComboBox Cell.

Also I do not initialize the Cell of the ComboBox to anything, could that be my problem, if so then how would I initailize it to a value in the list?

Thank you

Gary

1 solution

You find a version that works; then modify it to suit to your needs once you understand the concepts. If your changes break it, you did something wrong and back up. Start with examples in the ("official") docs.

DataGridViewComboBoxColumn Class (System.Windows.Forms) | Microsoft Docs[^]
   

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