I have a WindowsForms application in which I open a Form as a Dialog (Form2.ShowDialog) and in this Form I have a Timer that sets the TopMost property of the Form to true. But I also have a ComboBox in this Form and when I click on the ComboBox to select an Item, the list opens and closes immediately as the Timer sets the TopMost property back to true.
CodePudding user response:
If you ask me This is wrong way and should be replace your "load data function" from timer to form_load event. so if you want current way you should disable timer in ComboBox Enter Event and enable timer in ComboBox Leave Event.
private void comboBox1_Enter(object sender, EventArgs e)
{
timer1.Enabled = false;
}
private void comboBox1_Leave(object sender, EventArgs e)
{
timer1.Enabled = true;
}