|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Real Runtime Control -?-Private WithEvents MyTimer As VB.Timer Private Sub cmdCreateTimer_Click() Set MyTimer = Me.Controls.Add("VB.Timer", "tmrMyTimer", Me) MyTimer.Interval = 500 MyTimer.Enabled = True End Sub Private Sub cmdRemoveTimer_Click() MyTimer.Enabled = False Set MyTimer = Nothing Me.Controls.Remove "tmrMyTimer" End Sub Private Sub MyTimer_Timer() ' do something ... End Sub -- Works! The porpuse is to create eventually a Timer in runtime. -- What do thing about this code? <Harvey Triana /> Hi Harvey --
> Private WithEvents MyTimer As VB.Timer <snip>> -- Works! The porpuse is to create eventually a Timer in runtime. Well, what's the purpose? You haven't saved the need for a form. It's still not an > -- What do thing about this code? option in VB5 or VBA. If you want to create timers at runtime, I offer an class-based approach on my site -- http://vb.mvps.org/samples/TimerObj Later... Karl Hi Karl.
> Well, what's the purpose? OK. I have to implement an option of blinking in an user control that will be used very few times. The client uses an array of approximately 100 instances of the control. Well, thus i use less resources - doesn't it? <Harvey Triana /> Show quoteHide quote "Karl E. Peterson" <k***@mvps.org> escribió en el mensaje news:eBF2I0xkHHA.4848@TK2MSFTNGP05.phx.gbl... > Hi Harvey -- > >> Private WithEvents MyTimer As VB.Timer > <snip> >> -- Works! The porpuse is to create eventually a Timer in runtime. >> -- What do thing about this code? > > Well, what's the purpose? You haven't saved the need for a form. It's > still not an option in VB5 or VBA. > > If you want to create timers at runtime, I offer an class-based approach > on my site -- http://vb.mvps.org/samples/TimerObj > > Later... Karl > -- > .NET: It's About Trust! > http://vfred.mvps.org > Harvey Triana <harveytri***@hotmail.com> wrote:
>> Well, what's the purpose? I wouldn't think so. To make the extreme case, it's quite possible to share a > > OK. I have to implement an option of blinking in an user control that will > be used very few times. The client uses an array of approximately 100 > instances of the control. Well, thus i use less resources - doesn't it? single code-based timer in a situation as you suggest (http://vb.mvps.org/samples/SyncEvts). But to create 100 window-based timers is sucking up far more resources. The only concievable (by me) reason for doing that might be to allow for a randomness in the event firings, rather than the more ordered firings offered by a shared timer. Then again, you can still save the overhead of additional windows and messages by using individual code-based timer callbacks. Excellent. Thanks Karl.
<Harvey Triana /> Show quoteHide quote "Karl E. Peterson" <k***@mvps.org> escribió en el mensaje news:%23VUd7GykHHA.3512@TK2MSFTNGP06.phx.gbl... > Harvey Triana <harveytri***@hotmail.com> wrote: >>> Well, what's the purpose? >> >> OK. I have to implement an option of blinking in an user control that >> will >> be used very few times. The client uses an array of approximately 100 >> instances of the control. Well, thus i use less resources - doesn't it? > > I wouldn't think so. To make the extreme case, it's quite possible to > share a single code-based timer in a situation as you suggest > (http://vb.mvps.org/samples/SyncEvts). But to create 100 window-based > timers is sucking up far more resources. The only concievable (by me) > reason for doing that might be to allow for a randomness in the event > firings, rather than the more ordered firings offered by a shared timer. > Then again, you can still save the overhead of additional windows and > messages by using individual code-based timer callbacks. > -- > .NET: It's About Trust! > http://vfred.mvps.org >
VB 10 To Support Native Exe/DLL
Is there anyone uses VS6 on Windows2000 Pro? Exiting from a Do Loop Advice on storage and retrieval A bit of Maths help with arrays Closing recordset Excuting a command line program from within VB Sending email from app in vb6 to hotmail Type mismatch error Hyperlink in a CSV |
|||||||||||||||||||||||