954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Timer contral with multiple forms in VB.net

in VB.net, How can I use timer as a public and use this timer contral in the multiple form.

I have to do the trivia questions which user either select their answer to go to the next form or time up to the next form. I got the first part, but timeup the form I couldnt get it. How can I solve this, Please help.

notbunny
Newbie Poster
4 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

Hi

The way I manipulate controls in other forms is adding "Upgrade Support" to it.

If you want to enable the timer when the second form is loaded add the support to the form 1:

#Region "Upgrade Support "
	Private Shared m_vb6FormDefInstance As frmGraphs
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmGraphs
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmGraphs()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region

and enabvle the timer on the second form when it loads:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Form1.DefInstance.Timer1.Enabled = True

End Sub


when the timer ticks you will raise and event that you previously declared.

I don't know if that is what you mean, hope it helps.

Regards

williamrojas78
Junior Poster
111 posts since Jun 2005
Reputation Points: 23
Solved Threads: 10
 

thank you. I'll try to do with my code.

notbunny
Newbie Poster
4 posts since Apr 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You