471,337 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

datagridview - how to retrieve data help...

How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint

Jun 11 '07 #1
9 2536
Trint,

What do you mean by all of the data? You can always get the DataSource
and use the DataMember properties to get the actual data.

Are you setting the source of the data, or can it be anything? By that,
I mean, are you always using a data set to show the data, or is it possible
that other data objects are used?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"trint" <tr***********@gmail.comwrote in message
news:11*********************@g4g2000hsf.googlegrou ps.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint

Jun 11 '07 #2
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,

What do you mean by all of the data? You can always get the DataSource
and use the DataMember properties to get the actual data.

Are you setting the source of the data, or can it be anything? By that,
I mean, are you always using a data set to show the data, or is it possible
that other data objects are used?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"trint" <trinity.sm...@gmail.comwrote in message

news:11*********************@g4g2000hsf.googlegrou ps.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint- Hide quoted text -

- Show quoted text -
My datagridview contains products information

code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)

I want to know how to just retrieve the information displayed in the
datagridview so I can check
for changes or if something is deleted to send back to my sql server
tables.
Thanks,
Trint

Jun 11 '07 #3
Trint,

Right, but the grid has to be bound to something, like a dataset, a
collection, or something of that nature. It doesn't just magically get the
information. You should find out what the grid is bound to, and work with
that.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"trint" <tr***********@gmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Trint,

What do you mean by all of the data? You can always get the
DataSource
and use the DataMember properties to get the actual data.

Are you setting the source of the data, or can it be anything? By
that,
I mean, are you always using a data set to show the data, or is it
possible
that other data objects are used?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"trint" <trinity.sm...@gmail.comwrote in message

news:11*********************@g4g2000hsf.googlegro ups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint- Hide quoted text -

- Show quoted text -

My datagridview contains products information

code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)

I want to know how to just retrieve the information displayed in the
datagridview so I can check
for changes or if something is deleted to send back to my sql server
tables.
Thanks,
Trint

Jun 11 '07 #4
On Jun 11, 11:40 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,

Right, but the grid has to be bound to something, like a dataset, a
collection, or something of that nature. It doesn't just magically get the
information. You should find out what the grid is bound to, and work with
that.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"trint" <trinity.sm...@gmail.comwrote in message

news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Trint,
What do you mean by all of the data? You can always get the
DataSource
and use the DataMember properties to get the actual data.
Are you setting the source of the data, or can it be anything? By
that,
I mean, are you always using a data set to show the data, or is it
possible
that other data objects are used?
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
>news:11*********************@g4g2000hsf.googlegro ups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint- Hide quoted text -
- Show quoted text -
My datagridview contains products information
code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)
I want to know how to just retrieve the information displayed in the
datagridview so I can check
for changes or if something is deleted to send back to my sql server
tables.
Thanks,
Trint- Hide quoted text -

- Show quoted text -
Here is how I am binding to a datasource:

table0.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter0.Fill(table0);
bindingSource7.DataSource = table0;
dataGridView7.DataSource = bindingSource7;

this.dataGridView7.Columns[0].Width = 75;
this.dataGridView7.Columns[1].Width = 75;
this.dataGridView7.Columns[2].Width = 75;
this.dataGridView7.Columns[3].Width = 75;
this.dataGridView7.Columns[4].Width = 75;
this.dataGridView7.Columns[5].Width = 75;
this.dataGridView7.Columns[6].Width = 75;
this.dataGridView7.Columns[7].Width = 75;
this.dataGridView7.Columns[8].Width = 75;
this.dataGridView7.Columns["Column3"].Width = 75;
this.dataGridView7.Columns["Column5"].Width = 75;

But this is just to display the data.
Thanks,
Trint

Jun 11 '07 #5
On Jun 11, 2:07 pm, trint <trinity.sm...@gmail.comwrote:
On Jun 11, 11:40 am, "Nicholas Paldino [.NET/C# MVP]"

<m...@spam.guard.caspershouse.comwrote:
Trint,
Right, but the grid has to be bound to something, like a dataset, a
collection, or something of that nature. It doesn't just magically get the
information. You should find out what the grid is bound to, and work with
that.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>>Trint,
> What do you mean by all of the data? You can always get the
>DataSource
>and use the DataMember properties to get the actual data.
> Are you setting the source of the data, or can it be anything? By
>that,
>I mean, are you always using a data set to show the data, or is it
>possible
>that other data objects are used?
>--
> - Nicholas Paldino [.NET/C# MVP]
> - m...@spam.guard.caspershouse.com
>"trint" <trinity.sm...@gmail.comwrote in message
>>news:11*********************@g4g2000hsf.googlegr oups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
>Trint- Hide quoted text -
>- Show quoted text -
My datagridview contains products information
code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)
I want to know how to just retrieve the information displayed in the
datagridview so I can check
for changes or if something is deleted to send back to my sql server
tables.
Thanks,
>Trint- Hide quoted text -
- Show quoted text -

Here is how I am binding to a datasource:

table0.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter0.Fill(table0);
bindingSource7.DataSource = table0;
dataGridView7.DataSource = bindingSource7;

this.dataGridView7.Columns[0].Width = 75;
this.dataGridView7.Columns[1].Width = 75;
this.dataGridView7.Columns[2].Width = 75;
this.dataGridView7.Columns[3].Width = 75;
this.dataGridView7.Columns[4].Width = 75;
this.dataGridView7.Columns[5].Width = 75;
this.dataGridView7.Columns[6].Width = 75;
this.dataGridView7.Columns[7].Width = 75;
this.dataGridView7.Columns[8].Width = 75;
this.dataGridView7.Columns["Column3"].Width = 75;
this.dataGridView7.Columns["Column5"].Width = 75;

But this is just to display the data.
Thanks,Trint- Hide quoted text -

- Show quoted text -
Here is what I want to do, but it doesn't allow it:

string selectedRows = string.Empty;
dataGridView7.SelectAll();
//dataGridView7.SelectedRows.ToString();
selectedRows = dataGridView7.SelectedRows.ToString();

Any help is appreciated.
Thanks,
Trint

Jun 11 '07 #6
Trint,

Why not just work with table0?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"trint" <tr***********@gmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 2:07 pm, trint <trinity.sm...@gmail.comwrote:
>On Jun 11, 11:40 am, "Nicholas Paldino [.NET/C# MVP]"

<m...@spam.guard.caspershouse.comwrote:
>Trint,
Right, but the grid has to be bound to something, like a dataset, a
collection, or something of that nature. It doesn't just magically get
the
information. You should find out what the grid is bound to, and work
with
that.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
>news:11**********************@c77g2000hse.googleg roups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,
> What do you mean by all of the data? You can always get the
DataSource
and use the DataMember properties to get the actual data.
> Are you setting the source of the data, or can it be anything?
By
that,
I mean, are you always using a data set to show the data, or is it
possible
that other data objects are used?
>--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
>"trint" <trinity.sm...@gmail.comwrote in message
>>news:11*********************@g4g2000hsf.googlegr oups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint- Hide quoted text -
>- Show quoted text -
My datagridview contains products information
code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)
I want to know how to just retrieve the information displayed in the
datagridview so I can check
for changes or if something is deleted to send back to my sql server
tables.
Thanks,
Trint- Hide quoted text -
- Show quoted text -

Here is how I am binding to a datasource:

table0.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter0.Fill(table0);
bindingSource7.DataSource = table0;
dataGridView7.DataSource = bindingSource7;

this.dataGridView7.Columns[0].Width = 75;
this.dataGridView7.Columns[1].Width = 75;
this.dataGridView7.Columns[2].Width = 75;
this.dataGridView7.Columns[3].Width = 75;
this.dataGridView7.Columns[4].Width = 75;
this.dataGridView7.Columns[5].Width = 75;
this.dataGridView7.Columns[6].Width = 75;
this.dataGridView7.Columns[7].Width = 75;
this.dataGridView7.Columns[8].Width = 75;
this.dataGridView7.Columns["Column3"].Width = 75;
this.dataGridView7.Columns["Column5"].Width = 75;

But this is just to display the data.
Thanks,Trint- Hide quoted text -

- Show quoted text -

Here is what I want to do, but it doesn't allow it:

string selectedRows = string.Empty;
dataGridView7.SelectAll();
//dataGridView7.SelectedRows.ToString();
selectedRows = dataGridView7.SelectedRows.ToString();

Any help is appreciated.
Thanks,
Trint

Jun 11 '07 #7
On Jun 11, 4:37 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,

Why not just work with table0?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"trint" <trinity.sm...@gmail.comwrote in message

news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 2:07 pm,trint<trinity.sm...@gmail.comwrote:
On Jun 11, 11:40 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,
Right, but the grid has to be bound to something, like a dataset, a
collection, or something of that nature. It doesn't just magically get
the
information. You should find out what the grid is bound to, and work
with
that.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>>Trint,
> What do you mean by all of the data? You can always get the
>DataSource
>and use the DataMember properties to get the actual data.
> Are you setting the source of the data, or can it be anything?
>By
>that,
>I mean, are you always using a data set to show the data, or is it
>possible
>that other data objects are used?
>--
> - Nicholas Paldino [.NET/C# MVP]
> - m...@spam.guard.caspershouse.com
>"trint" <trinity.sm...@gmail.comwrote in message
>>news:11*********************@g4g2000hsf.googlegr oups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
>Trint- Hide quoted text -
>- Show quoted text -
My datagridview contains products information
code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)
I want to know how to just retrieve the information displayed in the
datagridview so I can check
for changes or if something is deleted to send back to my sql server
tables.
Thanks,
>Trint- Hide quoted text -
- Show quoted text -
Here is how I am binding to a datasource:
table0.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter0.Fill(table0);
bindingSource7.DataSource = table0;
dataGridView7.DataSource = bindingSource7;
this.dataGridView7.Columns[0].Width = 75;
this.dataGridView7.Columns[1].Width = 75;
this.dataGridView7.Columns[2].Width = 75;
this.dataGridView7.Columns[3].Width = 75;
this.dataGridView7.Columns[4].Width = 75;
this.dataGridView7.Columns[5].Width = 75;
this.dataGridView7.Columns[6].Width = 75;
this.dataGridView7.Columns[7].Width = 75;
this.dataGridView7.Columns[8].Width = 75;
this.dataGridView7.Columns["Column3"].Width = 75;
this.dataGridView7.Columns["Column5"].Width = 75;
But this is just to display the data.
Thanks,Trint- Hide quoted text -
- Show quoted text -
Here is what I want to do, but it doesn't allow it:
string selectedRows = string.Empty;
dataGridView7.SelectAll();
//dataGridView7.SelectedRows.ToString();
selectedRows = dataGridView7.SelectedRows.ToString();
Any help is appreciated.
Thanks,
Trint- Hide quoted text -

- Show quoted text -
I'm not sure I understand what you mean...Don't I first have to know
what has changed
and how to get it from the grid? I will work with the table after I
know what I have in the datagridview.
What am I missing?
Thanks,
Trint

Jun 11 '07 #8
Trint,

If you have set the data source of the grid to the table, then when you
make changes in the grid, the DataTable (table0) will be updated
accordingly.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"trint" <tr***********@gmail.comwrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
On Jun 11, 4:37 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Trint,

Why not just work with table0?

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"trint" <trinity.sm...@gmail.comwrote in message

news:11**********************@c77g2000hse.googleg roups.com...
On Jun 11, 2:07 pm,trint<trinity.sm...@gmail.comwrote:
On Jun 11, 11:40 am, "Nicholas Paldino [.NET/C# MVP]"
><m...@spam.guard.caspershouse.comwrote:
Trint,
Right, but the grid has to be bound to something, like a
dataset, a
collection, or something of that nature. It doesn't just magically
get
the
information. You should find out what the grid is bound to, and
work
with
that.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
>news:11**********************@c77g2000hse.googleg roups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,
> What do you mean by all of the data? You can always get the
DataSource
and use the DataMember properties to get the actual data.
> Are you setting the source of the data, or can it be
anything?
By
that,
I mean, are you always using a data set to show the data, or is
it
possible
that other data objects are used?
>--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
>"trint" <trinity.sm...@gmail.comwrote in message
>>news:11*********************@g4g2000hsf.googlegr oups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
Trint- Hide quoted text -
>- Show quoted text -
My datagridview contains products information
code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)
I want to know how to just retrieve the information displayed in
the
datagridview so I can check
for changes or if something is deleted to send back to my sql
server
tables.
Thanks,
Trint- Hide quoted text -
- Show quoted text -
>Here is how I am binding to a datasource:
>table0.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter0.Fill(table0);
bindingSource7.DataSource = table0;
dataGridView7.DataSource = bindingSource7;
> this.dataGridView7.Columns[0].Width = 75;
this.dataGridView7.Columns[1].Width = 75;
this.dataGridView7.Columns[2].Width = 75;
this.dataGridView7.Columns[3].Width = 75;
this.dataGridView7.Columns[4].Width = 75;
this.dataGridView7.Columns[5].Width = 75;
this.dataGridView7.Columns[6].Width = 75;
this.dataGridView7.Columns[7].Width = 75;
this.dataGridView7.Columns[8].Width = 75;
this.dataGridView7.Columns["Column3"].Width = 75;
this.dataGridView7.Columns["Column5"].Width = 75;
>But this is just to display the data.
Thanks,Trint- Hide quoted text -
>- Show quoted text -
Here is what I want to do, but it doesn't allow it:
string selectedRows = string.Empty;
dataGridView7.SelectAll();
//dataGridView7.SelectedRows.ToString();
selectedRows = dataGridView7.SelectedRows.ToString();
Any help is appreciated.
Thanks,
Trint- Hide quoted text -

- Show quoted text -

I'm not sure I understand what you mean...Don't I first have to know
what has changed
and how to get it from the grid? I will work with the table after I
know what I have in the datagridview.
What am I missing?
Thanks,
Trint

Jun 11 '07 #9
On Jun 11, 5:17 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,

If you have set the data source of the grid to the table, then when you
make changes in the grid, the DataTable (table0) will be updated
accordingly.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"trint" <trinity.sm...@gmail.comwrote in message

news:11**********************@w5g2000hsg.googlegro ups.com...
On Jun 11, 4:37 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Trint,
Why not just work with table0?
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
>news:11**********************@c77g2000hse.googleg roups.com...
On Jun 11, 2:07 pm,trint<trinity.sm...@gmail.comwrote:
On Jun 11, 11:40 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Trint,
Right, but the grid has to be bound to something, like a
dataset, a
collection, or something of that nature. It doesn't just magically
get
the
information. You should find out what the grid is bound to, and
work
with
that.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"trint" <trinity.sm...@gmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
On Jun 11, 11:00 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>>Trint,
> What do you mean by all of the data? You can always get the
>DataSource
>and use the DataMember properties to get the actual data.
> Are you setting the source of the data, or can it be
>anything?
>By
>that,
>I mean, are you always using a data set to show the data, or is
>it
>possible
>that other data objects are used?
>--
> - Nicholas Paldino [.NET/C# MVP]
> - m...@spam.guard.caspershouse.com
>"trint" <trinity.sm...@gmail.comwrote in message
>>news:11*********************@g4g2000hsf.googlegr oups.com...
How can I retrieve all of the data from a datagridview?
Any help is appreciated.
Thanks,
>Trint- Hide quoted text -
>- Show quoted text -
My datagridview contains products information
code/name/price/salePrice/cost/overSize/stock/change(button)/
delete(button)
I want to know how to just retrieve the information displayed in
the
datagridview so I can check
for changes or if something is deleted to send back to my sql
server
tables.
Thanks,
>Trint- Hide quoted text -
- Show quoted text -
Here is how I am binding to a datasource:
table0.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter0.Fill(table0);
bindingSource7.DataSource = table0;
dataGridView7.DataSource = bindingSource7;
this.dataGridView7.Columns[0].Width = 75;
this.dataGridView7.Columns[1].Width = 75;
this.dataGridView7.Columns[2].Width = 75;
this.dataGridView7.Columns[3].Width = 75;
this.dataGridView7.Columns[4].Width = 75;
this.dataGridView7.Columns[5].Width = 75;
this.dataGridView7.Columns[6].Width = 75;
this.dataGridView7.Columns[7].Width = 75;
this.dataGridView7.Columns[8].Width = 75;
this.dataGridView7.Columns["Column3"].Width = 75;
this.dataGridView7.Columns["Column5"].Width = 75;
But this is just to display the data.
Thanks,Trint- Hide quoted text -
- Show quoted text -
Here is what I want to do, but it doesn't allow it:
string selectedRows = string.Empty;
dataGridView7.SelectAll();
//dataGridView7.SelectedRows.ToString();
selectedRows = dataGridView7.SelectedRows.ToString();
Any help is appreciated.
Thanks,
Trint- Hide quoted text -
- Show quoted text -
I'm not sure I understand what you mean...Don't I first have to know
what has changed
and how to get it from the grid? I will work with the table after I
know what I have in the datagridview.
What am I missing?
Thanks,
Trint- Hide quoted text -

- Show quoted text -
Can you please give me an example?

Jun 12 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by karthigaj | last post: by
reply views Thread by sghante | last post: by

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.