Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Problems with properly using a DataGridView

$
0
0

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 it's 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.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>