Click here to Skip to main content
15,029,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is probably old question but can't find an answer...
I have a DataGridView and display a query results in it

Table1: Field1, Field2, ID
Table2: ID, LName, FName

DataSet ds get values from "SELECT Field1, Field2, LName & ' ' & FName As Name FROM Table1, Table2 WHERE Table1.ID = Table2.ID"
dGrid.DataSource = ds.Tables[0]

Then I'd like to make 3rd column a combobox with an option to select values from Table2

dGrid.Columns.Remove("Name");
DataGridViewComboBoxColumn cbc = new DataGridViewComboBoxColumn();
DataSet ds1 get from "SELECT ID, LName & ' ' & FName As Name FROM Table2"
cbc.DataPropertyName = "Name";
cbc.DataSource = ds1.Tables[0];
cbc.ValueMember = "Name";
cbc.DisplayMember = "Name";
dGrid.Columns.Insert(2, cbc);

Gives me Argument Exception error. Not sure why.
Does anybody have a working example?
Thanks
Posted

1 solution

Try debugging your source code and figure out which line throws the error.
   

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