[RESOLVED] Declaring components without drawing on form
VB Code:
Option Explicit
Private WithEvents TCalculateBandwidth As Timer
Private Sub Form_Load()
Me.Move 0, 0
With TCalculateBandwidth
.Interval = 1000
.Enabled = True
End With
End Sub
Private Sub TCalculateBandwidth_Timer()
MsgBox "yay"
End
End Sub
I have a felling I am missing a Set in the Form_Load but when I type out "Set TCalculateBandwidth =" a true false select box comes up. :s
Re: Declaring components without drawing on form
If you want to create controls at runtime use the Controls.Add method
VB Code:
Private WithEvents TCalculateBandwidth As VB.Timer
Private Sub Form_Load()
Me.Move 0, 0
Set TCalculateBandwidth = Controls.Add("VB.Timer", "Timer1")
With TCalculateBandwidth
.Interval = 1000
.Enabled = True
End With
End Sub
Private Sub TCalculateBandwidth_Timer()
MsgBox "yay"
TCalculateBandwidth.Enabled = False
Unload Me
End Sub