|
-
Nov 1st, 2000, 01:18 AM
#1
Thread Starter
Lively Member
I have looked and tried some of the examples from VB World.
I have a label with the caption "Please wait..."
This label is only to appear when i click on the command button...
Many exmaples VB WORLD have the label appearing when the form loads eventhough the label at design time is set to false and the property on the control is false and the form load there is nothing about the label...
I want the label to blink when the user clicks on the command button or any other ideas but i want to keep it simple
Can anyone paste some code to show me
Thank you
Steve
-
Nov 1st, 2000, 02:08 AM
#2
Lively Member
put a label, a timer and a commandbutton on a form
Code:
Private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled
Label1.Visible = Timer1.Enabled
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 500
Label1.Caption = ""
Label1.Visible = False
End Sub
Private Sub Timer1_Timer()
If Label1.Caption = "" Then
Label1.Caption = "Please Wait..."
Else
Label1.Caption = ""
End If
End Sub
-
Nov 1st, 2000, 02:12 AM
#3
transcendental analytic
Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Command1_Click()
Dim temp As String
Do
temp = Label1.Tag
Label1.Tag = Label1
Label1 = temp
X = GetTickCount + 500
Do Until X < GetTickCount Or Forms.Count = 0
DoEvents
Loop
Loop Until stopdoingthis Or Forms.Count = 0
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 1st, 2000, 10:06 AM
#4
Thread Starter
Lively Member
Reply - Kedaman
Works great!
Label blinks and there is no opening pause
The only question is how to I get out of this loop?
I can not get out of the loop and my system does not execute!
Steve
-
Nov 1st, 2000, 10:20 AM
#5
transcendental analytic
the stopdoingthis i wrote there in my code was meant to show you, you put the boolean variable or expression to determine when to exit the loop
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 1st, 2000, 10:26 AM
#6
Thread Starter
Lively Member
Reply - Kedaman
Kedaman..
Can you help me get out of the loop?
I want it to stop when the frmoption displays...
Thank you,
Steve
-
Nov 1st, 2000, 10:31 AM
#7
Frenzied Member
I can help you...
change this line
Code:
Loop Until stopdoingthis Or Forms.Count = 0
to
Code:
Loop Until stopdoingthis Or Forms.Count = 0 Or frmOption.Visible
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 1st, 2000, 10:38 AM
#8
Thread Starter
Lively Member
relpy
Do I have to use a loop
Is there any other way of disabling the blinking?
I put the Loop Until stopdoingthis Or Forms.Count = 0 Or frmOption.Visible
at the end of my code and the pause is still there
-
Nov 1st, 2000, 10:54 AM
#9
_______
<?>
Code:
Private Declare Function GetTickCount Lib "kernel32" () As Long
Public stopdoingthis As Boolean
Private Sub Command1_Click()
stopdoingthis = False
Dim temp As String
Do
temp = Label1.Tag
Label1.Tag = Label1
Label1 = temp
X = GetTickCount + 500
Do Until X < GetTickCount Or Forms.Count = 0
DoEvents
Loop
Loop Until stopdoingthis = True
End Sub
Private Sub Label1_Click()
'wherever you make frmOption visible or whatever
stopdoingthis = True
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 1st, 2000, 11:11 AM
#10
Thread Starter
Lively Member
Reply
Here is my code:
How do i get out of the loop ?
If I put my code between the Do Until and the loop, the label never actually blinks...
Dim Msg, Style, Title, Response
lblTimer.Visible = True
tmr1.Enabled = True
stopdoingthis = False
Dim temp As String
Do
temp = lblTimer.Tag
lblTimer.Tag = lblTimer
lblTimer = temp
X = GetTickCount + 500
Do Until X < GetTickCount Or Forms.Count = 0
DoEvents
Loop
Loop Until stopdoingthis Or Forms.Count = 0 Or frmOption.Visible
Set myWorkBook = myExeclApp.Workbooks.Open("d:\temp\temp.xls")
Set myWorksheet = myWorkBook.Worksheets(2)
-
Nov 1st, 2000, 11:22 AM
#11
Frenzied Member
HeSaidJoe's code works perfectly for me, don't see the point 
where do you put your code?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 1st, 2000, 11:31 AM
#12
Thread Starter
Lively Member
I am having problems here:
The pause is when I open the excel spreadsheet
Can someone please help me fix this problem
After the excel opens I want to have the label stop blinking
Dim Msg, Style, Title, Response
lblTimer.Visible = True
tmr1.Enabled = True
stopdoingthis = False
Dim temp As String
Do
temp = lblTimer.Tag
lblTimer.Tag = lblTimer
lblTimer = temp
X = GetTickCount + 500
Do Until X < GetTickCount Or Forms.Count = 0
DoEvents
Set myWorkBook =myExeclApp.Workbooks.Open
("d:\temp\temp.xls")
Set myWorksheet = myWorkBook.Worksheets(2)
Loop
Loop Until stopdoingthis Or Forms.Count = 0 Or frmOption.Visible
-
Nov 1st, 2000, 11:43 AM
#13
_______
<?>
Use the code from kedaman and the added piece by myself.
Change your label caption to read. "Click here to open file" or whatver your instructions would be.
Then put your code for open excel in the label click event with my code and away you go.
As you have it you are firing off a blink and opening a file and telling it to stop blinking when you open. It's all happening at once. I can't see how it will blink when you open at the same time.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jan 12th, 2001, 05:04 PM
#14
Member
This do the same, but less code.
for lasy programmers!!
Option Explicit
Private Sub cmdconnect_Click()
Timer1.Interval = 400
Label1.Caption = "Please wait..."
End Sub
Private Sub Timer1_Timer()
Label1.Visible = Not Label1.Visible
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|