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.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.