jackjohnson44
asked on
datagridview combobox bind
how do you bind a datagrid's combo box to a dataset or table? I am setting the grid up in the designer, declaring the row name, then want to bind in code.
So I have the first column in the datagrid with the name "customerName" and a datatable with a column by the same name I want to populate it with.
So I have the first column in the datagrid with the name "customerName" and a datatable with a column by the same name I want to populate it with.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes it does not! but the binding works always the same nevermind where the combobox is! When the binding works with a combobox directly in a windows.forms it also works with a datagridview...
If i missunderstand a problem in your question please try to explain it in a different way or show me the code where the troubles occure!
best regards
If i missunderstand a problem in your question please try to explain it in a different way or show me the code where the troubles occure!
best regards
ASKER
I am accepting to close the question, but I really don't think that you read the question. Binding to a datagridview combobox is the problem. Telling me to go through a document just to find .datasource and .datamemeber doesn't help at all. That is pretty basic. Either I should already know that, or you could have posted two lines. Reguardless, I did not say how do you bind. I had a specific question that your link in no way answered. Sorry to bark at you, but in my experience once a few people have commented, the question just sits there. People who go around posting half-assed answers or links just waste a lot of time. To get around this, I have posted other questions to have a clean post. Then I get in trouble for posting the same question again. Again, I am not trying to give you a hard time, but I use this site as a resource, and throwing around a bunch of links ruins the resource, and wastes time for everyone.
Here is the right answer
Dim dRow As DataRow
dRow = m_dsLookups.Brokers.NewRow ()
dRow("Name") = ""
dRow("GUID") = System.Guid.Empty
m_dsLookups.Brokers.Rows.I nsertAt(dR ow, 0)
'this is in no way obvious, and can't be figured out from your link
Dim cb As New DataGridViewComboBoxColumn
cb = Me.DGBrokers.Columns("Brok erGUID")
cb.DataSource = m_dsLookups.Brokers
cb.DisplayMember = "Name"
cb.ValueMember = "GUID"
Here is the right answer
Dim dRow As DataRow
dRow = m_dsLookups.Brokers.NewRow
dRow("Name") = ""
dRow("GUID") = System.Guid.Empty
m_dsLookups.Brokers.Rows.I
'this is in no way obvious, and can't be figured out from your link
Dim cb As New DataGridViewComboBoxColumn
cb = Me.DGBrokers.Columns("Brok
cb.DataSource = m_dsLookups.Brokers
cb.DisplayMember = "Name"
cb.ValueMember = "GUID"
ASKER