I have (re)discovered the joys of Visual Basic! But anyway, in lieu of any available textbooks telling me how to do stuff, I wanna know:
How to get it to “wait X seconds” before doing something
How to make text and/or pictures appear outside a Form
Either how (if possible) to make a String array with an unspecified amount of elements (I’m going to be reading from a file, and to get each line will involve a different command), or how to select differing elements of a single string (i.e. select line 3 of the string “Five syllables, then(newline)seven and then five again.(newline)All in all, three lines.”)
How to get a text box set “multiline” to actually BE multiline when you set a string to it! (Trying to set the text box’s text as the above string simply makes it “Five syllables, thenseven and then five again.All in all, three lines.”)
You need to use a timer. Set the interval in milliseconds, and if you don’t want it to start initially, just leave it disabled and enable it as you need it.
Not a clue. I’ve never seen anything like that.
Just dimension it without any parameters initially (i.e. “Dim String()”), and then you can redimension it later with a variable (i.e. “ReDim String(Integer)” or “ReDim Preserve…” if you need to keep the contents of the array). You can also use the Split function to separate stings.
Are you asking how to insert new lines? Try “Textbox.Text = ‘first line’ & vbCrLf & ‘second line’”
VB isn’t so bad, but there isn’t really all that much you can really do with it, in my opinion. If you can figure out how to use MFS or Qt or some such graphical set, then C++ would probably be the best for graphical environments, due to the limitations of VB, and ASM for console apps.
Okay … use a timer how, exactly? Like, what commands do you use if you want to wait a randomized amount of seconds, then turn the form’s background blue for five seconds, then change it back?
Alright… First you need to place a timer on your form. Then on form load, you can set an integer to some random value. I believe timers only go up to two minutes, so you could do RandomInteger = Int(120000 * Rnd + 1), and then set that as the Interval. Or, more efficiantly, you could just do something like “Timer.Interval = Int(120000 * Rnd + 1)”.
Then, under the timer’s section of your code, you could do
Form.BackColor = vbBlue
Timer2.Interval = 5000
Timer2.Enabled = True
and “Form.BackColor = &H8000000F” under Timer2’s code, assuming Timer2 was not enabled initially.
All righty then … how about if I want to loop something in a timer? Like, make a text box (txtText, for the purposes of this example) count down from ten to one using a variable and “intInteger = intInteger - 1”? (i.e. it says “10” then waits a second then “9” and so on)