Expand|Select|Wrap|Line Numbers
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Timers;
- namespace WindowsFormsApplication2
- {
- public partial class Form1 : Form
- {
- private static System.Timers.Timer aTimer;
- public Form1()
- {
- InitializeComponent();
- aTimer = new System.Timers.Timer();
- aTimer.Elapsed += new ElapsedEventHandler(found_card);
- // Set the Interval to 2 seconds.
- aTimer.Interval = 1000;
- aTimer.Enabled = true;
- }
- private void found_card(object sender, EventArgs e)
- {
- aTimer.Enabled = false;
- // use smart card system to find the card. if found the card, it will open form2 and close form1
- Form form2 = new Form2();
- this.Hide(); // <--- error, please help me to make a solution
- form2.ShowDialog();
- this.Close();
- }
- }
- }