Results 1 to 3 of 3

Thread: searching .txt file for entries? Returning info to seperate text boxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    2

    searching .txt file for entries? Returning info to seperate text boxes

    I apoligise if the post discription is not correct or detailed enough!

    I have read the forum from page 1 to 30 but I am not sure what I am actually looking for.
    I am a new user of the 2005 beta editon of Visual Basic so my terminology will not be real precise.
    (new to the forum so hopefully I have posted in the correct area for help with Visual Basic 2005 express beta)
    So please be patient with me.


    I am trying to read a .txt file and extract certain lines
    So that I can preform a graph for the information contained in the txt file.
    Is thier a way to search the text file for certain lines and print that out to another file.
    This is an example
    If it reads
    Place=12
    I want the 12 to show up on my new form with the 12 being placed in a textbox defined by me.
    The Place=#will differ per driver
    Driver=Mark j
    The drivers name will differ also
    I want Mark j to show up under "Driver" on my graph style form.
    and so on.
    Hopefully that makes some sense.
    After I see a small demonstration of how one might go about doing this I think I can continue on with this project.


    What I have at the moment is just the basic open the text file and it shows up in my text box.lol
    I want it to open the text file sort out the needed entries and only show those in a graph.
    Thier will be up too 43 [Slot] Entries that need to be sorted out.
    Place=
    Driver=
    Qualification=
    among other entries I will be needing to extract from the text file
    If you Have any Ideas I would appreciate the help
    Some posts here seemed to be kinda what I was looking for but I guess I just need to see it work with what I am using to fully understand.
    I will be searching a text file like below
    Each driver entered into the game has his or her own SLOT



    [Slot]
    Place=12
    SlotID=0
    Control=2
    Driver=Mark j
    VehicleName=#48
    VehicleFile=GAMEDATA\VEHICLES\2005 IROC\IROC\48\48.VEH
    GarageIndex=0
    PitIndex=11
    DNF=1
    DNF Reason=4
    DQ=0
    LapsLead=0
    Best Lap Time=39.679
    Best Lap Start=18.991
    Total ET=0.000
    Total Laps=1
    Lap=(0, -1.000, 39.679)
    Sector 0 Best=39.679
    Sector 1 Best=11.469
    Sector 2 Best=28.328
    Total Fines=0.000000
    Qualification=12

    The number of lines differ depending on how many laps were completed by a participant here is another SLOT that has a different number of lines because of the # of laps completed by the driver in the race

    [Slot]
    Place=7
    SlotID=1
    Control=4
    Driver=JJ Yeley
    VehicleName=#80
    VehicleFile=GAMEDATA\VEHICLES\2005 IROC\IROC\80\80.VEH
    GarageIndex=0
    PitIndex=5
    DNF=0
    DNF Reason=0
    DQ=0
    LapsLead=0
    Best Lap Time=36.100
    Best Lap Start=274.921
    Total ET=1698.919
    Total Laps=44
    Lap=(0, -1.000, 39.388)
    Lap=(1, 57.549, 59.946)
    Lap=(2, 117.495, 53.704)
    Lap=(3, 171.199, 66.009)
    Lap=(4, 237.208, 37.712)
    Lap=(5, 274.921, 37.586)
    Lap=(6, 312.507, 38.609)
    Lap=(7, 351.116, 38.433)
    Sector 0 Best=37.586
    Sector 1 Best=10.619
    Sector 2 Best=27.246
    Total Fines=0.000000
    Qualification=6

    That is why I need to search for certain text fields to produce a accurate reading of the text file.
    Depending on laps completed the
    Qualification entry would be farther down the list so reading a certain line number would produce a different result
    The First slot qualification= entry is line 25 and the second Slot example Qualification= is line 31
    So I think I would have to search for the line
    Qualification= then produce the number folowing that entry.

    I hope I am making sense


    If you can help me I would really appreciate it!
    I will be honest with you I have not done much programming at all. I have written a few small programs that are just tutorial exercises but as far as writing one without guidance I am totally lost when it comes to new things I have not read about.
    Just an example of loading the text file and searching it for Driver= and Place= and listing each onto different seperate text boxes would help alot so I can see how to have the search string set up, to search for multiple entries.
    To produce the desired effect.



    Thank you for your time.

    Mark

  2. #2
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: searching .txt file for entries? Returning info to seperate text boxes

    Here is an article/example of how to read INI files in VB.net

    http://www.codeproject.com/vb/net/VbNetClassIniFile.asp
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    2

    Re: searching .txt file for entries? Returning info to seperate text boxes

    Thank You For Your Reply.
    I have been doing alot of reading and I will eventually get it.
    I will post the solution once I get it resolved.

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