Click to See Complete Forum and Search --> : Why doesn't this work


anonymous
03-07-2003, 04:44 AM
[Originally posted by James Boudreau]

I have a form with a command button "command1", a label "label1" a text box "text1" and a timer " timer1" This is set up to display a different caption at different intervals, However only the command button is displaying the caption. can someone tell me what is wrong that the label and text box are not displaying the text?

here is my code


Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)



Private Sub Timer1_Timer()
MousePointer = 11
ÿ ÿ Label1.Caption = "this is a test......."
ÿ ÿ Command1.Caption = "this is a test........"
ÿ ÿ Text1.Text = "this is a test........"
Sleep (3500)
ÿ ÿ Label1.Caption = "testing opening files............."
ÿ ÿ Command1.Caption = "testing opening files............."
ÿ ÿ Text1.Text = "testing opening files............."
Sleep (3000)
ÿ ÿ Label1.Caption = "test Opening Completed..."
ÿ ÿ Command1.Caption = "test Opening Completed..."
ÿ ÿ Text1.Text = "test Opening Completed..."
Sleep (2400)
ÿ ÿ Label1.Caption = "test Loading Main Window"
ÿ ÿ Command1.Caption = "test Loading Main Window"
ÿ ÿ Text1.Text = "test Loading Main Window"
Sleep (1900)
ÿ ÿ Label1.Caption = "test Loading somethingelse .... Please Wait)"
ÿ ÿ Command1.Caption = "test Loading something else .... Please Wait)"
ÿ ÿ Text1.Text = "test Loading something else .... Please Wait)"
Sleep (1500)
ÿ ÿ Label1.Caption = "Loading Complete"
ÿ ÿ Command1.Caption = "Loading Complete"
ÿ ÿ Text1.Text = "Loading Complete"
Sleep (1400)
ÿ ÿ Label1.Caption = "this is a test"
ÿ ÿ Command1.Caption = "this is a test"
ÿ ÿ Text1.Text = "this is a test"
Sleep (1000)
Timer1.Enabled = False
MousePointer = 1
Load Form2
Form2.Show
Unload Me
End Sub


when it is done form2 loads properly, the only problem is the label and text box are not displaying anything.

anonymous
03-07-2003, 05:10 AM
[Originally posted by Larry Asher]

Try working with the DoEvents command.

Example:

...
ÿ ÿ Label1.Caption = "this is a test......."
ÿ ÿ Command1.Caption = "this is a test........"
ÿ ÿ Text1.Text = "this is a test........"
ÿ ÿ DoEvents
Sleep (3500)

Or even

...
ÿ ÿ Label1.Caption = "this is a test......."
ÿ ÿ DoEvents
ÿ ÿ Command1.Caption = "this is a test........"
ÿ ÿ DoEvents
ÿ ÿ Text1.Text = "this is a test........"
ÿ ÿ DoEvents
Sleep (3500)

One of those should work for you.

Good Luck.

anonymous
03-07-2003, 06:18 AM
[Originally posted by Mikekay2]

use the .refresh method

i.e. label1.refresh

you could also try setting the forms clipcontrols property to false.

incidently this seems rather a bizarre use for a timer

anonymous
03-07-2003, 12:33 PM
[Originally posted by James Boudreau]

the doevents worked great. I have made many programs where text is displayed on a label or text box and they always worked. I wonder why this didn't work this time? I am suppose to vote for you for helping me? Can you tell me how? In reply to mkay who also helped me, it is unusual use of a timer but it's just to give the illision that a program is loading. Thank you both for all your help.