PC Review


Reply
Thread Tools Rate Thread

datagridview saving

 
 
RobcPettit@yahoo.co.uk
Guest
Posts: n/a
 
      19th Jan 2008
Hi, I need some advice on how to proceed with saving gridview
contents. Ive got a 'datagridview control' on a form, so its window
application only not web. I fill this programatically with
'dataGridView1.Rows.Add(whatever array)' so its not bound to a
database. Once the data in I want to save the data in a format that I
can 1,reuse in the datagrid or 2, as an excel file. From what Ive
googled so far, this doesnt seem possible without using a dataset. So
am I correct in thinking that my best course of action is to--Send my
data to a database, create a dataset, bound this to datagridview and
then either stream into excel or possible save as xml file to reuse in
application. Or is there a way to avoid dataset. I dont have a problem
with 'dataset' its creating the database Im not clear on. Even after
googling. Thanks in advance.
Regards Robert
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      19th Jan 2008
Robert,

You don't HAVE to use a database in order to use a DataSet. You can
populate a DataSet with your data, and then just save it as XML if you want.
There is no need to interact with a database at all.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, I need some advice on how to proceed with saving gridview
> contents. Ive got a 'datagridview control' on a form, so its window
> application only not web. I fill this programatically with
> 'dataGridView1.Rows.Add(whatever array)' so its not bound to a
> database. Once the data in I want to save the data in a format that I
> can 1,reuse in the datagrid or 2, as an excel file. From what Ive
> googled so far, this doesnt seem possible without using a dataset. So
> am I correct in thinking that my best course of action is to--Send my
> data to a database, create a dataset, bound this to datagridview and
> then either stream into excel or possible save as xml file to reuse in
> application. Or is there a way to avoid dataset. I dont have a problem
> with 'dataset' its creating the database Im not clear on. Even after
> googling. Thanks in advance.
> Regards Robert



 
Reply With Quote
 
 
 
 
RobcPettit@yahoo.co.uk
Guest
Posts: n/a
 
      19th Jan 2008
Thankyou for your reply. That makes things clearer then. Create my
dataset and use in datagridview. Am I write that, to save contents of
datagridview, you have to have a dataset?.
Regards Robert
 
Reply With Quote
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      19th Jan 2008
Robert,

No, you don't have to have a dataset. You can bind a DataGridView to
anything that implements IList. The DataGridView will use the classes in
the System.ComponentModel namespace to get the information about the types
exposed through the IList implementation.

However, for the most part though, if your data needs aren't too
complex, and you don't have a specific need for this kind of typing (for the
individual rows in the data grid view), then the data set is just fine.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thankyou for your reply. That makes things clearer then. Create my
> dataset and use in datagridview. Am I write that, to save contents of
> datagridview, you have to have a dataset?.
> Regards Robert



 
Reply With Quote
 
RobcPettit@yahoo.co.uk
Guest
Posts: n/a
 
      19th Jan 2008
Thanks for making that clear. Working with dataset was easier than I
thought, so Ill stick with it. Thanks for your time.
Regards Robert
 
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
Copy from datagridview and paste to second datagridview ing.Zeco Microsoft C# .NET 2 29th Oct 2007 07:41 AM
Datagridview - Writing Journal Transactions for a Datagridview =?Utf-8?B?Qm9iIFJvZ2d5?= Microsoft VB .NET 0 1st Nov 2006 02:40 PM
DataGridView (.NET 2.0 Windows Forms) Text wrapping in DataGridView Items Chris Hayes Microsoft Dot NET Framework 1 27th Aug 2006 06:07 PM
Clearing selection in DataGridView when user clicks outside the DataGridView control djyakov@gmail.com Microsoft Dot NET Framework Forms 0 16th Feb 2006 07:38 PM
Refreshing datagridview contents after a failed delete in bound datagridview Bob Microsoft VB .NET 0 5th Jan 2006 07:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:25 AM.