We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,555 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Save Datagridview contents

hey,
I have tried many methods to save my datagridview contents to a file
but with no luck
does anybody have a good method for xml to datagridview, datagridview to Xml,
or any other methods to read/write a datagridview

2
Contributors
3
Replies
3 Days
Discussion Span
2 Years Ago
Last Updated
6
Views
Huntondoom
Light Poster
48 posts since Jul 2010
Reputation Points: 10
Solved Threads: 5
Skill Endorsements: 0

i did it once and it worked fine
i remember i did row1:cell;cell;cell|row2:cell;cell;cell ...
you can choose any other delimiter
than use the split method to reload the text into the dgrid.

ÜnLoCo
Light Poster
40 posts since Dec 2009
Reputation Points: 10
Solved Threads: 8
Skill Endorsements: 0

oh so for each row you create a line (of string),
thnx!

ps: I created this with the information for saving:

Dim content As String
        For I As Integer = 0 To DataGridView1.Rows.Count
            For J As Integer = 0 To DataGridView1.ColumnCount
                content = content & ";" & DataGridView1.Rows(I).Cells(J).Value.ToString
            Next
            content = content & vbCrLf
        Next
Huntondoom
Light Poster
48 posts since Jul 2010
Reputation Points: 10
Solved Threads: 5
Skill Endorsements: 0

use for each .. it's better i think
note: be careful with the delimiters .. only use chars you don't use in the cell contents like "#" or "|" or maybe "^"

ÜnLoCo
Light Poster
40 posts since Dec 2009
Reputation Points: 10
Solved Threads: 8
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0662 seconds using 2.64MB