I'm just starting out with c# and I have a splashscreen form:
I use the system.timer, and would like to hide & deallocate the form when "OnTimedEvent" is called. But I'm able to use the "this" keyword. How would I refer to the form itself?Code:namespace LottoWiz { public partial class SplashScreen : Form { public SplashScreen() { System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 4 * 1000; // splashscreen shows for 4 seconds. aTimer.Enabled = true; InitializeComponent(); } private void SplashScreen_Load(object sender, EventArgs e) { this.TopMost = true; } private static void OnTimedEvent(object source, ElapsedEventArgs e) { this.hide(); // how? } } }
Thanks!




Reply With Quote