Click to See Complete Forum and Search --> : Using a datagrid with a text file instead of database???


animal415
03-20-2006, 05:47 PM
Hi,
this may not even be possible, but I need to know. I am trying to create a windows app, that would allow users to fill in some text boxes and make some selections, after they click "Add", they would then instantly populate a datagrid. After several additions (rows in the datagrid) the user could save what they've done to a file. That file could be retrieved later and loaded (into the datagrid) as a template and allow any row to be selected and edited and resaved. How can I do this? Or maybe a datagrid isn't the answer. Either way, I'm trying to create a file that can be loaded, saved and edited easily. Say I've created a template with 6 rows and saved it. Later I go back and I load it. Now I want to edit row 4 and save it again. How can I go about doing this? any ideas? Potentially, any number of templates could be created, saved and be available for a user to choose from. If Datagrid isn't the answer, maybe another road to go down??

mcmcom
03-20-2006, 10:50 PM
i suggest you use XML to write too, it will maintain row and data structure a bit better. You just create DataSets and DataTables from the datagrid and write them to xml. the same process is used to write to text. Lookinto the StreamWriter class and XmlWriter and DataSet. Also search google for "output datagrid to text".

hth,
mcm

animal415
03-21-2006, 11:55 AM
thanks for the tip. After posting this question last night, I realized XML may be the way to go. I will look into it. thanks again.

handshakeit
03-22-2006, 11:32 PM
yes I am agree it is better to use xml or csv files insted of using text file for data as these are better formatted

Thanx
Abhi
www.Handshakeit.com