I have an application that consists of several forms. There is a MainForm and then other forms open up within this MainForm. One of the child forms that opens up (we'll just call it Form1) contains a user control that has controls inside it, such as a datagrid view. This datagridview control has several events that are triggered, one being a "cellclick" event.
This click event must access a public timer object that is declared in Form1.
Currently just to make it work I used the code:
((Form1)this.Parent.Parent.Parent.Parent.Parent).clickTimer.Start();
However this doesn't seem like the best way I could be accessing this Timer object, and could potentially be a headache for future development of Form1 and its User Controls.
What are alternative ways of accessing my Form1 timer from inside the user control's datagridview click event?
Any advice is appreciated as I'm drawing a blank on this right now.
Thanks