Problems with properly using a DataGridView

  • Thread starter Thread starter GarbageSauce
  • Start date Start date
G

GarbageSauce

Guest
Hi everybody. So I have a DataGridView control on my form. One of the columns on this DataGridView is a combobox.

I have 2 classes. A Products class and an Orders class. The Products class has a property called Name which refers to the name of the product. The Orders class has a property called Type which directly refers to the product assigned to the order.

Here is my code:

columnProducts.ValueType = typeof(Product);
columnProducts.DataPropertyName = "type";
columnProducts.ValueMember = "type";
columnProducts.DisplayMember = "name";
columnProducts.DataSource = products;

gridOrders.DataSource = orders;
This puts out exceptions like its going out of style. What I want to happen is when a new product is added, the ComboBox cell fills with the list of products WITH the product assigned to the order already selected. I just want to enable the user to be able to quickly change the product assigned to the order by simply choosing a new product from the ComboBox. Is this possible? Thanks!



In Calculus, 1+1=0.

Continue reading...
 
Back
Top