Click here to Skip to main content
12,299,554 members (54,487 online)
Rate this:
 
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
esb77617

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
Top Experts
Last 24hrsThis month


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100