|
-
Dec 9th, 2007, 07:11 PM
#1
Thread Starter
Hyperactive Member
[2005] Data Grid View problem
I can't get my datagridview control on my form (named dgv) to actually display a dataset that I know is not empty. I know I'm forgetting something stupid but I skimmed through the list of methods and properties of the datagridview control and I didn't see anything too familiar. Here's my current code:
Code:
Dim ds As New DataSet()
ds.ReadXml(txtPathA.Text)
MessageBox.Show(ds.Tables(0).Rows(0).Item(0))
dgv.DataSource = ds
And the messagebox does in fact show what's in the first table's first row in the first column but dgv is still totally blank and has a rowcount of 0 and everything after it all executed. I know with like list boxes and stuff if you bind it to a datasource, you have to set the display member or something but I don't remember what I'm forgetting for the dgv!
EDIT: well I just realized it can display one single table at a time but I couldda sworn I saw a DGV at some point display multiple tables at a time so what's up with that?
Last edited by Desolator144; Dec 9th, 2007 at 07:56 PM.
I tried to end process on Visual Studio 2005
but PETA stopped me saying it's smart enough
to be a living creature 
-
Dec 9th, 2007, 09:09 PM
#2
Re: [2005] Data Grid View problem
If you bind a DataSet then you need to set the DataMember to specify the DataTable to display.
The DataGridView does not support relationship navigation at all. The DataGrid does but will still only display data from one table at a time. You'd need to create your own customised grid, which would be a lot of work, or use a third party control if you want more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|