| Author |
Message |
nalsur8
Guest
|
Posted:
Fri Jan 28, 2005 10:01 am Post subject:
timer or delay... |
|
|
vba autocad have timer or not if not how to make it
let say in textbox or image every second will be change
any picture or number
|
|
| Back to top |
|
 |
fantum
Guest
|
Posted:
Fri Jan 28, 2005 6:46 pm Post subject:
Re: timer or delay... |
|
|
Given a UserForm named UserForm1 with a TextBox named TextBox1 and a module, put this in the module:
Public Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Public idTimer As Long
Public Sub TimerFunc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal IDEvent As Long, ByVal dwTime As Long)
UserForm1.TextBox1.Text = CStr(Val(UserForm1.TextBox1.Text) + 1)
End Sub
and this in the userform:
Private Sub UserForm_Initialize()
'timer with 1000 ms period
idTimer = SetTimer(0, 0, 1000, AddressOf TimerFunc)
End Sub
Private Sub UserForm_Terminate()
If 0 <> idTimer Then
Call KillTimer(0, idTimer)
End If
End Sub |
|
| Back to top |
|
 |
nalsur8
Guest
|
Posted:
Sat Jan 29, 2005 6:02 am Post subject:
Re: timer or delay... |
|
|
it's can change number to alphabet (ABC...Z)
actualy what i want is, in userform have 3 button
and 1 textbox, textbox1 funtion for alphabet only and change
random automatic when the user press 1 of 3 button and value in
textbox1 will be change as random,
let say in textbox1 value is K and pause til user press
1 of 3 button, when user press the button textbox1 change
to next alphabet as randomly it's can?
fantum <nospam@address.withheld> wrote in message
news:22969725.1106919992432.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | Given a UserForm named UserForm1 with a TextBox named TextBox1 and a
module, put this in the module:
Public Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal
nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal
nIDEvent As Long) As Long
Public idTimer As Long
Public Sub TimerFunc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal IDEvent
As Long, ByVal dwTime As Long)
UserForm1.TextBox1.Text = CStr(Val(UserForm1.TextBox1.Text) + 1)
End Sub
and this in the userform:
Private Sub UserForm_Initialize()
'timer with 1000 ms period
idTimer = SetTimer(0, 0, 1000, AddressOf TimerFunc)
End Sub
Private Sub UserForm_Terminate()
If 0 <> idTimer Then
Call KillTimer(0, idTimer)
End If
End Sub |
|
|
| Back to top |
|
 |
fantum
Guest
|
Posted:
Mon Jan 31, 2005 6:01 pm Post subject:
Re: timer or delay... |
|
|
| I don't see where a timer would be involved in generating a random letter. See the documentation for the Rnd function for generating a random number. You can translate the generated number into a letter using an array look-up or the Chr function. |
|
| Back to top |
|
 |
|
|
|
|