Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Save TO xml FROM datagridview

Save TO xml FROM datagridview

Scheduled Pinned Locked Moved C#
questioncomxmlhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nelsonpaixao
    wrote on last edited by
    #1

    Hi, how can i save the contents of a dgv to a xml file? i know how to read from xml to dgv. because the dataset has more that one table and the datagrid only display one table, im affraid o mess it when saving. I Checking it know, but if anyone can direct me to some link or code would be helpfull :-D

    nelsonpaixao@yahoo.com.br trying to help & get help

    D M 2 Replies Last reply
    0
    • N nelsonpaixao

      Hi, how can i save the contents of a dgv to a xml file? i know how to read from xml to dgv. because the dataset has more that one table and the datagrid only display one table, im affraid o mess it when saving. I Checking it know, but if anyone can direct me to some link or code would be helpfull :-D

      nelsonpaixao@yahoo.com.br trying to help & get help

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Move your data to a DataSet/DataTable object(s) and the rest is easy. It's save to an XML file in one statement.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      1 Reply Last reply
      0
      • N nelsonpaixao

        Hi, how can i save the contents of a dgv to a xml file? i know how to read from xml to dgv. because the dataset has more that one table and the datagrid only display one table, im affraid o mess it when saving. I Checking it know, but if anyone can direct me to some link or code would be helpfull :-D

        nelsonpaixao@yahoo.com.br trying to help & get help

        M Offline
        M Offline
        Mbah Dhaim
        wrote on last edited by
        #3

        cast your datagridview.DataSource to DataTable then save its contents to XML file

        DataTable myDataTable =(Datatable)dgv.DataSource;
        myDataTable.WriteXml(filename);

        hope it helps

        dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups