PC Review


Reply
Thread Tools Rate Thread

Best way to display selective data using a datagrid and dataset

 
 
=?Utf-8?B?RnVuZ2kyMDAz?=
Guest
Posts: n/a
 
      24th May 2004
I am binding a datagrid to a dataset but there are some columns I don't want show in the dataset, what is the easiest way of removing these columns yet still binding to that dataset?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2FkaGEgU2l2YW0=?=
Guest
Posts: n/a
 
      24th May 2004
Hi

You can try using GridColumnStyles property to add or remove a column

Steps to do that

1. Create a reference for DataGridTableStyl

Dim tableStyle As New DataGridTableStyle(

2. Create a DataGridTextBoxColumn or DataGridBoolColumn, which is going to represent the column (choose the first one if we are going to display a textbox, or if check box is to be displayed use the second one

Dim Colu As New DataGridTextBoxColum
Colu.MappingName = "<filed name in the data table>
Colu.HeaderText = "Text to be displed in the header
Colu.Width = 3
tableStyle.GridColumnStyles.Add(colu

3. Link this add all the column, the columns will get populated in the same order added to the tablestyle
4. Clear the TablesStyles property of the datagri

datagrid1.TableStyles.Clear(

5. Add the tablestyle object tot he Tablestyles of the datagrid

datagrid1.TableStyles.Add(tableStyle

After this you will be getting all ur required fields. A new column can also be added to the datagrid by adding a column to the datatable and defining the datatablestyle

I hope i made it very clear. Feel free to contact me

Sadha Sivam
Microsoft Community Star
Malleable Minds Software Pvt Ltd.
India
(E-Mail Removed)
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      24th May 2004
"Fungi2003" <(E-Mail Removed)> schrieb
> I am binding a datagrid to a dataset but there are some columns I
> don't want show in the dataset, what is the easiest way of removing
> these columns yet still binding to that dataset?


Have a look here:
microsoft.public.dotnet.framework.windowsforms.databinding


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      24th May 2004
Hi Armin,

Answer is given by Sadha

Cor


 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
display and access selected items from dataSet to Datagrid in asp.net ajaspersonal@gmail.com Microsoft ASP .NET 0 7th Mar 2007 04:46 AM
Can't display dataset in windows form datagrid =?Utf-8?B?dml0YQ==?= Microsoft Dot NET Framework Forms 1 28th Mar 2005 07:59 PM
DataGrid won't display DataSet =?Utf-8?B?Qm9i?= Microsoft Dot NET Compact Framework 2 27th Dec 2004 07:22 PM
using Crystal Reports to display data in my dataset correctly (display the data I selected instead of all the data in table) JK Microsoft C# .NET 1 6th Sep 2003 10:10 PM
How to refresh DataGrid to display latest dataset data?? Ivan Microsoft ADO .NET 1 30th Jul 2003 12:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:28 AM.