Results 1 to 6 of 6

Thread: [RESOLVED] [2005 Service Pack 1] Data Grid View

  1. #1

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Resolved [RESOLVED] [2005 Service Pack 1] Data Grid View

    I have a data grid view and i want to know how i can have the data entered saved to a file... a .ini file? whatever type of file that can save a database of information entered into the data grid view

    thanks a bunch,
    Phil
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005 Service Pack 1] Data Grid View

    Are you intending to read or display this data anywhere other than this grid? If not then the easiest way would be to bind your grid to a DataSet and use its ReadXml and WriteXml to load and save the data with one line of code. An XML file will be a bit larger than a comparable plain text file but it also stores a lot more type information for the data, not just the data itself.

    Having said that, you'd generally be better off using an actual database rather than jusr data files. Even an Access database offers you greater functionality than a data file, but something like SQL Server Express provides more functionality again. Of course, with additional functionality comes additional overhead and that may be undesirable.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: [2005 Service Pack 1] Data Grid View

    no, it wouldn't be read by anything else, but it will store passwords so i was wondering if it'd be possible to encrypt it in some sort of way. I wouldn't want to use sql server since i didn't bother to install it since i wouldn't use it for anything else than that, so an xml file would be good.
    how can i bind it to a dataset?
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005 Service Pack 1] Data Grid View

    Assign the DataSet to the DataSource and the name of the table to the DataMember.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: [2005 Service Pack 1] Data Grid View

    ok, i've set the dataset to the datasource... umm, what's the datamember? name of the table of what?
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  6. #6

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: [2005 Service Pack 1] Data Grid View

    ugh, sorry for my stupidity i'm tired... i found it thanks a lot

    EDIT:
    kk, i've done that and now i have a problem. this is my code:
    VB Code:
    1. Private Sub SaveDataToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveDataToolStripMenuItem.Click
    2.         DataSet1.WriteXml("database.xml")
    3.     End Sub
    4.  
    5.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    6.         DataSet1.ReadXml("database.xml")
    7.     End Sub
    when it opens up the database.xml file, all of the cells are empty
    Last edited by smart_phil_dude1; Jan 22nd, 2007 at 07:32 PM.
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width