Datagrid / Dataset question

  • Thread starter Thread starter Phil Snijder
  • Start date Start date
P

Phil Snijder

Hi there,

I have a form with a Datagrid on it; Datagrid is bound to an untyped dataset.
When I fill the dataset (with an oleDBDataAdapter), the data is not diplayed directly in the grid;
I have to expand some control that appears in the datagrid, and then select the table name
before the data is shown. How can I make this work directly??

Thanks in advance!

Gr.
Phil
 
You should try :

dataGrid1.SetDataBinding(dataset, "table");

or.....

dataGrid1.DataSource = dataset;
dataGrid1.DataMember = "table";
 
I should add that, with at lest .NET Framework 1.0, the second approach
should never be used, while the first one is the way to go. The difference
is that the SetDataBinding method appears to perform some inner
initializations on the DataGrid, and these initializations never occur when
the DataSource and the DataMember properties are assigned directly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top