Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / January 2008

Tip: Looking for answers? Try searching our database.

datagridview saving

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RobcPettit@yahoo.co.uk - 18 Jan 2008 23:02 GMT
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
Nicholas Paldino [.NET/C# MVP] - 18 Jan 2008 23:15 GMT
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.

Signature

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

> Hi, I need some advice on how to proceed with saving gridview
> contents. Ive got a 'datagridview control' on a form, so its window
[quoted text clipped - 10 lines]
> googling. Thanks in advance.
> Regards Robert
RobcPettit@yahoo.co.uk - 18 Jan 2008 23:20 GMT
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
Nicholas Paldino [.NET/C# MVP] - 18 Jan 2008 23:33 GMT
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.

Signature

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

> 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
RobcPettit@yahoo.co.uk - 18 Jan 2008 23:55 GMT
Thanks for making that clear. Working with dataset was easier than I
thought, so Ill stick with it. Thanks for your time.
Regards Robert

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.