Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 5-Sep-12 4:16am
esb77460

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 449
1 Maciej Los 274
2 CPallini 160
3 Sergey Alexandrovich Kryukov 152
4 Richard MacCutchan 130
0 OriginalGriff 5,474
1 Sergey Alexandrovich Kryukov 4,713
2 Peter Leow 2,944
3 DamithSL 2,465
4 Maciej Los 2,434


Advertise | Privacy | Mobile
Web03 | 2.8.140718.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid