|
-
Feb 19th, 2010, 11:44 PM
#1
Thread Starter
Lively Member
Dynamic Timer in a Dynamic Form.
Hey guys. I've been having trouble with this and need another angle. Ive managed to dynamically create a form, and dynamically create a timer, but i have not been able to create the timer on the dynamic form. Specifically, i need to be able to have the timer itself create another form with a timer. (I realize that this would create a new form every interval on the timer, that is what i want to do)
I need help with these things;
1. A way to add the timer to the dynamic form, and maintain the timer sub on my main form.
2. A way to create the whole thing over (dynamic form and timer) through the previous dynamic form and timer.
I was thinking i could use a collection/array to store the forms and timers, but i'm still having trouble figuring out how to add entire forms or timers into a list. (A timer is not considered a control, so i cant use a controlcollection...)
Heres my code;
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frm As New Form
Dim timer As New System.Timers.Timer(3000)
Dim tcollection As Collection
tcollection.Add(timer)
Dim i As Integer = 1
frm.Width = 500
frm.Height = 500
frm.BackColor = Color.Black
frm.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
timer.Enabled = True
AddHandler timer.Elapsed, AddressOf Timer_tick
End Sub
Private Sub Timer_tick(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs)
MsgBox("test")
End Sub
*EDIT* Btw, my idea was to use i as a variable that increases every time a form is created, then insert the form into the array, with i as the integer. i just need to know how to create a new form with a different name each time. (as with timers)
Last edited by manbearpig001; Feb 20th, 2010 at 01:28 AM.
Tags for this Thread
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
|