473,394 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Convert DataGrid to datatable

Hi,

Is there an easy way , maybe a cast or something to place all of the items
from a datagrid into a dataset.
Sort of the opposite of binding a datatable to a datagrid.

any help is appreciated.

cheers

martin
Nov 18 '05 #1
3 14736
DataSet ds = new DataSet();
ds.Columns...

DataView dv = new DataView( ds.Tables[0] );

DataGrid grid = new DataGrid();
grid.DataSource = dv;

//Cast as DataView
DataView _newDV = (DataView) grid.DataSource

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net


On Wed, 7 Jul 2004 08:52:52 +1200, "martin"
<St**************@yahoo.com> wrote:
Hi,

Is there an easy way , maybe a cast or something to place all of the items
from a datagrid into a dataset.
Sort of the opposite of binding a datatable to a datagrid.

any help is appreciated.

cheers

martin


Nov 18 '05 #2
Thank you,

I will try this..
"Bobby Ryzhy" <br****@hotmail.com> wrote in message
news:mq********************************@4ax.com...
DataSet ds = new DataSet();
ds.Columns...

DataView dv = new DataView( ds.Tables[0] );

DataGrid grid = new DataGrid();
grid.DataSource = dv;

//Cast as DataView
DataView _newDV = (DataView) grid.DataSource

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net


On Wed, 7 Jul 2004 08:52:52 +1200, "martin"
<St**************@yahoo.com> wrote:
Hi,

Is there an easy way , maybe a cast or something to place all of the itemsfrom a datagrid into a dataset.
Sort of the opposite of binding a datatable to a datagrid.

any help is appreciated.

cheers

martin

Nov 18 '05 #3
Anytime.

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net

On Wed, 7 Jul 2004 11:34:45 +1200, "martin"
<St**************@yahoo.com> wrote:
Thank you,

I will try this..
"Bobby Ryzhy" <br****@hotmail.com> wrote in message
news:mq********************************@4ax.com.. .
DataSet ds = new DataSet();
ds.Columns...

DataView dv = new DataView( ds.Tables[0] );

DataGrid grid = new DataGrid();
grid.DataSource = dv;

//Cast as DataView
DataView _newDV = (DataView) grid.DataSource

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net


On Wed, 7 Jul 2004 08:52:52 +1200, "martin"
<St**************@yahoo.com> wrote:
>Hi,
>
>Is there an easy way , maybe a cast or something to place all of theitems >from a datagrid into a dataset.
>Sort of the opposite of binding a datatable to a datagrid.
>
>any help is appreciated.
>
>cheers
>
>martin
>


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: JLong | last post by:
I am in pain here, so help please. I have a form with a datagrid control to display a single datatable (created in memory). I use the form's new sub to initialize the datatable and set the schema...
0
by: Emerson | last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C# Here's my scenario I click in a cell on a DataGrid. I enter some...
0
by: VM | last post by:
In my Windows application, I load an ascii file into a tableX and set the datagrid.DataSource = tableX. The problem begins when I try to retrieve the data from the grid in order to process the...
3
by: clyyy2002 | last post by:
At added two column and more column hereafter,I immediately click del button,the program is no problem. but if i first click the DataGrid columnHeader and then click the del button, i find when...
0
by: GroZZleR | last post by:
Hey all, How can you expand the column sizes to ALWAYS take up atleast 100% of the DataGrid / DataTable? Right now my columns look like this: http://www.grozzler.com/dump/dt_mine.png I...
0
by: CSerpent | last post by:
AFTER A "REFRESH", HOW DO I RETURN THE USER TO THE RECORD HE WAS PREVIOUSLY WORKING WITH? I have a DataTable, and a bound DataGrid. The DataTable contains a column which is Unique, but the...
6
by: Rob | last post by:
I am trying to copy some data from one datagrid to another. The first datagrid containing data is called DocList. The blank Datagrid that I am trying to copy some data to is called DataGrid1. ...
3
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
2
by: Risen | last post by:
Hi, How to convert datagrid control's data to xml? thx all.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.