PC Review


Reply
Thread Tools Rate Thread

Add a Timer to a form at run time

 
 
=?Utf-8?B?dmluYXk=?=
Guest
Posts: n/a
 
      24th Feb 2004
Hi

I must be missing some obvious point, but can someone let me know how do I add a windows.forms.timer control to a form at run time

Private TM as new windows.forms.time
Dim sForm as for

sForm.controls.add(TM)
=> throwing an error - Value of type 'System.Windows.Forms.Timer' cannot be converted to 'System.Windows.Forms.Control'

Basically I have a progress bar in this form which I want to update under a Timer control. I can access this progress bar using sForm.Controls but unable to get a handle on this timer component.

Regard

Vina

 
Reply With Quote
 
 
 
 
Cor
Guest
Posts: n/a
 
      24th Feb 2004
Hi vinay,


\\\
dim withevents mytimer as windows.forms.timer
mytimer.enabled = true
////

I hope this helps,

Cor

>
> I must be missing some obvious point, but can someone let me know how do I

add a windows.forms.timer control to a form at run time.
>
> Private TM as new windows.forms.timer
> Dim sForm as form
>
> sForm.controls.add(TM)
> => throwing an error - Value of type 'System.Windows.Forms.Timer'

cannot be converted to 'System.Windows.Forms.Control'.
>
> Basically I have a progress bar in this form which I want to update under

a Timer control. I can access this progress bar using sForm.Controls but
unable to get a handle on this timer component.
>
> Regards
>
> Vinay
>



 
Reply With Quote
 
Rigga
Guest
Posts: n/a
 
      24th Feb 2004
To add to what Cor has already posted....

You can't add a timer into a form because it isn't a control, as the error
stated..
however there's no need to add it to the form to use it..

Just declare it as in Cor's earlier reply.

You will also need to Add a Handler for the Tick event
and Start the Timer

as in

// Code //
Private SomeCode Sub
Dim timer as New windows.forms.timer
AddHandler timer.Tick, Addressof MyTimerHandlersSub
timer.start
End Sub

Private Sub MyTimerHandlersSub(ByVal sender As System.Object, ByVal e As
System.EventArgs)

' Do Something Usefull in Here....!!!! like update your progress bar....

End Sub

//End Code//

HTH
Rigga.

"vinay" <(E-Mail Removed)> wrote in message
news:31728AEE-23BF-47B2-9650-(E-Mail Removed)...
> Hi,
>
> I must be missing some obvious point, but can someone let me know how do I

add a windows.forms.timer control to a form at run time.
>
> Private TM as new windows.forms.timer
> Dim sForm as form
>
> sForm.controls.add(TM)
> => throwing an error - Value of type 'System.Windows.Forms.Timer'

cannot be converted to 'System.Windows.Forms.Control'.
>
> Basically I have a progress bar in this form which I want to update under

a Timer control. I can access this progress bar using sForm.Controls but
unable to get a handle on this timer component.
>
> Regards
>
> Vinay
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form timer does not fire on time! Mourad Microsoft Access 3 8th Dec 2008 08:04 PM
Accumulate time in min or seconds using Timer? Cip Loera Jr Microsoft Access Form Coding 1 12th Sep 2008 06:45 PM
timer click button every X time =?Utf-8?B?QXZpIEc=?= Microsoft C# .NET 1 29th Jun 2006 09:12 AM
Timer not being time-true =?Utf-8?B?RGlhbmVQRGF2aWVz?= Microsoft Access Form Coding 3 10th May 2005 02:52 PM
timer- to know time of last action.... Shivalee Gupta via AccessMonster.com Microsoft Access 10 25th Jan 2005 07:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:37 AM.