Results 1 to 10 of 10

Thread: loading stuff into a Datagrid without a Database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176

    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?
    JpEgy

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    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.

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    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

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    ..?

    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.

  5. #5
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Dont gain the world and lose your soul

  6. #6
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    thanks

    i will check it out
    Magiaus

    If I helped give me some points.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    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

  8. #8
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    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

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    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...
    JpEgy

  10. #10
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    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
  •  



Click Here to Expand Forum to Full Width