0

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.

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by notbunny
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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.