|
-
Mar 28th, 2002, 07:13 AM
#1
Thread Starter
Addicted Member
loading stuff into a Datagrid without a Database
I'm not using a database but a txt file to store stuff and i want to continue doing so. Is there any way i can load stuff into the datagrid without loading it from a database? Else, what object should i use?
-
Mar 28th, 2002, 01:14 PM
#2
Frenzied Member
umm....
Elaberate on Stuff because you could write it out to a file (*.txt) and then load and bind at run time with ADO.Net but that is still in a sense a database.....
elaberate some
Magiaus
If I helped give me some points.
-
Mar 28th, 2002, 02:22 PM
#3
Frenzied Member
It also depends on how those "stuff" is organized in the file, but it is possible. However if you wanted to make things really easier, you could use an XML file, as it makes things really simple when you are reading and writing from the file.
There is an example in the C# forum about how to do this in XML.
Hope that helped.
Dont gain the world and lose your soul
-
Mar 28th, 2002, 02:29 PM
#4
Frenzied Member
..?
So you can bind a control to an xml object? I don't know don't use XML much
can you post a link to the thread?
Magiaus
If I helped give me some points.
-
Mar 28th, 2002, 08:13 PM
#5
Frenzied Member
Dont gain the world and lose your soul
-
Mar 29th, 2002, 02:18 AM
#6
Frenzied Member
Magiaus
If I helped give me some points.
-
Mar 29th, 2002, 08:07 AM
#7
Thread Starter
Addicted Member
i checked it out but it still want to use the plain old textfile. I don't know much about xml and just loading text into the dataobject sounds much better to me ;-)
And BTW i already made loading and saving procedures and they work very well. It's just that i can't get any data into the DataGrid....all the examples use XML.
Last edited by JpEgy; Mar 29th, 2002 at 08:27 AM.
JpEgy
-
Mar 29th, 2002, 10:23 AM
#8
Frenzied Member
Ok, here is a scenario.
Make a struct or a class for the type of data in the text that you want to load. You can read a block of lines into the struct or the class then add that struct or class to a dynamic array (arraylist). Each block of lines should be one record separated by a blank line or whatever you choose.
after you have read all the records, just write a foreach loop and load everything in the datagrid.
Post an example of the text file with the stuff you are trying to load and I will tell you best way to do it.
Dont gain the world and lose your soul
-
Mar 29th, 2002, 12:00 PM
#9
Thread Starter
Addicted Member
after you have read all the records, just write a foreach loop and load everything in the datagrid.
that's what i'm asking! i know how to do the loop that's no problem but how can i add text to the datagrid?
About the textfile, it's for a program that help you to learn words.
a file looks like this:
TOMMY2K
hallo=hello
stoel=chair
eten=to eat
tafel=table
hond=dog
kat=cat
frans=french
lopen=to walk
geluid=sound
SLUITEN
the first word is a dutch word and the second one is (duhh) english
Now i made some nice loops to loop this into 2 arrays. the first one called Knownwords contains the dutch words and the second one called Unknownwords contains the english words. I need 2 colomns for the datagrid, 1 for the know- and one for the unknown words. I already did this using a listbox but that really doesn;t do. Thnx for all the help you can give me!
PS: the TOMMY2k and SLUITEN are open and close tags...
-
Mar 29th, 2002, 02:23 PM
#10
Frenzied Member
Ok cool, there should be a way to load the data into the data grid. I wont be able to try this until I go home later, so please be patient.
Anyway, just keep trying until you come up with something
Dont gain the world and lose your soul
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
|