Results 1 to 4 of 4

Thread: 5 Questions.. about Files and ect..

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Posts
    482

    Question

    Hey, i have 5 Questions.. if u post a reply please use
    (1), (2), ect about which question you are answering..
    I could probably figure these out.. but it'd take awhile and this is maybe the only thing holding me back.. so i want to do it the *RIGHT* way.. insted of my way...
    THANKS to all

    Situation: Using Vb6 Enter, i am making a MULTIPLAYER internet game, and as most of you know, you have to do alot of opening/saving for options/data.

    (1) I saw somewhere that there is a way to make VB wait, untill the previous statement is done, before going to the next, can someone tell me how this is done... BTW: i don't want it to "hang" there for a couple of seconds, like wait till the previous statement is done, (maybe opening a file) and when it is done READ the data from it, while letting other things on the form still active and running.

    (2) How would i go about getting ONE LINE of a file and setting it to say, SavedData1.. like
    SavedData1 = File blah, Line 1

    (3) How would i go about SAVING a RichTextBox with multiple lines, IE, an example i wanted was EACH line of the RTB is saved into another line of the file, and it is opened (The max number of lines is 5)

    (4)How would i go about SAVING something like
    Blaf = Text & "Hello World" ' just an example, not real text =) --- [cont'd] into a CERTAIN line of a file (line 3) persay...

    (5) Last question =) (((About LOGS)))
    I am dealing with LOGS and RichTextBoxes (because they display multiple colors) How would i *SAVE* a richtextbox to the *-LAST-* line of a file.. say i have

    --------example file------
    12/4/2000
    User Kicked.
    User Banned.

    13/5/2000
    User Logged in
    User Kicked
    --------------------------
    but.. it could be ANY SIZE and the RTB data would still be saved to a NEW line at the bottom.. but SKIPPING a line b4 saving.. so it looks like

    --------example file------
    12/4/2000
    User Kicked.
    User Banned.

    13/4/2000
    User Logged in
    User Kicked

    14/4/2000
    New Data here
    Blah
    --------------------------

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ....

    I shall be frank. I wanted to be the first to reply you, so I am answering two of your questions.

    (1) To make VB wait means it checks for any user input. I think you require the 'DoEvents' statement here. Syntax is simple:

    DoEvents



    (3) The RTB has properties LoadFile and SaveFile using which you can save or retrieve files into the RTB.
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    (2)
    If you know the number of the line you want to read, use Object.SkipLine to get to it, then use Object.ReadLine to read it.

    Assuming of course you are using the wonderfull TextObject Model that comes with VB6.

    This may also go some way to answering Q(4).

  4. #4
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    PS

    DoEvents is only useful in a loop or in lots of small processes (not one big one)

    1) You could implemet threading if the long function is in a BAS module, but it's a bit complex.

    If you want to use threading, see:

    http://www.planetsourcecode.com/vb/s...txtCodeId=4823

    Courgettes.

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