G
G-Oker
Guest
Hello,
I'm trying to create a custom Messagebox, so I can get it to close after a specific period of time with a "virtual" button press, but I am unable to get the timer_tick to work.
public partial class DialogBox : Form
{
public DialogBox()
{
InitializeComponent();
Timer1.Tick += Timer1_Tick;
}
private void DialogBox_Shown(object sender, EventArgs e)
{
Timer1.Start();
}
private void btnYes_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Yes;
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void Timer1_Tick(object sender, EventArgs e)
{
btnYes.Enabled = true;
Timer1.Stop();
}
}
Can someone please point out what I am doing wrong?
thank you
Continue reading...
I'm trying to create a custom Messagebox, so I can get it to close after a specific period of time with a "virtual" button press, but I am unable to get the timer_tick to work.
public partial class DialogBox : Form
{
public DialogBox()
{
InitializeComponent();
Timer1.Tick += Timer1_Tick;
}
private void DialogBox_Shown(object sender, EventArgs e)
{
Timer1.Start();
}
private void btnYes_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Yes;
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void Timer1_Tick(object sender, EventArgs e)
{
btnYes.Enabled = true;
Timer1.Stop();
}
}
Can someone please point out what I am doing wrong?
thank you
Continue reading...