|
-
Jan 21st, 2007, 08:53 PM
#1
Thread Starter
Lively Member
[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
-
Jan 21st, 2007, 09:07 PM
#2
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.
-
Jan 22nd, 2007, 03:54 PM
#3
Thread Starter
Lively Member
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?
-
Jan 22nd, 2007, 06:00 PM
#4
Re: [2005 Service Pack 1] Data Grid View
Assign the DataSet to the DataSource and the name of the table to the DataMember.
-
Jan 22nd, 2007, 06:11 PM
#5
Thread Starter
Lively Member
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?
-
Jan 22nd, 2007, 07:22 PM
#6
Thread Starter
Lively Member
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:
Private Sub SaveDataToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveDataToolStripMenuItem.Click
DataSet1.WriteXml("database.xml")
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DataSet1.ReadXml("database.xml")
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|