PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Datagridview questions

Reply

Datagridview questions

 
Thread Tools Rate Thread
Old 13-01-2006, 04:32 PM   #1
=?Utf-8?B?QnJpYW4=?=
Guest
 
Posts: n/a
Default Datagridview questions


I've got a couple questions on the new Datagridview control in VS2005.

1) In the old datagrid control at design time I was able to add multiple
tablestyles with columns from different datasources. Then at run time when I
would bind a dataset to the grid it would display the tablestyle associated
with the dataset. How do I do this in VS2005?

2) I do all my databinding to the datagridview at run time, but setup my
columns as unbound then set the datapropertyname. When the code runs it
displays my columns correctly, but also adds any additional dataset columns
to datagridview. Is there a way to only display the fields I setup under the
column properties?

dsData = New DataSet
dsData.ReadXml(Application.StartupPath & "\valves.xml")
dgvSearch.DataSource = dsData.Tables(0)

Thanks
  Reply With Quote
Old 13-01-2006, 04:59 PM   #2
Chris
Guest
 
Posts: n/a
Default Re: Datagridview questions

Brian wrote:
> I've got a couple questions on the new Datagridview control in VS2005.
>
> 1) In the old datagrid control at design time I was able to add multiple
> tablestyles with columns from different datasources. Then at run time when I
> would bind a dataset to the grid it would display the tablestyle associated
> with the dataset. How do I do this in VS2005?
>
> 2) I do all my databinding to the datagridview at run time, but setup my
> columns as unbound then set the datapropertyname. When the code runs it
> displays my columns correctly, but also adds any additional dataset columns
> to datagridview. Is there a way to only display the fields I setup under the
> column properties?
>
> dsData = New DataSet
> dsData.ReadXml(Application.StartupPath & "\valves.xml")
> dgvSearch.DataSource = dsData.Tables(0)
>
> Thanks



1) The DataGridView is not a replacement for the DataGrid at all. The
DataGridView is used to show data from one datatable. It is not as
flexible as the DataGrid, but is more easily customized for showing data
from one table. If you need multiple tablestyles, use the datagrid,
that's why it is still there.

2) Turn off AutoGenerateColumns in the DataGridView

Hope it helps.
Chris
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off