-
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
--------------------------
-
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.
-
(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).
-
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