All of the child forms have a common factor and that is they all use while loops. I am collecting a ton of serial data and looping works best. Does the loop have something to do with it, I would expect the App.doevents() to handle the event correctly when it fires. Below you will find the constructor, MyForm_Method, which contains the while loop and a timer to trigger the method once the constructor is done.
Thank you.
public
MyForm() { // Required for Windows Form Designer support
InitializeComponent();
//TODO: Add any constructor code after InitializeComponent call
Close 'X' button problem on child form
Segua
Thanks,
Karen
lingling
All of the child forms have a common factor and that is they all use while loops. I am collecting a ton of serial data and looping works best. Does the loop have something to do with it, I would expect the App.doevents() to handle the event correctly when it fires. Below you will find the constructor, MyForm_Method, which contains the while loop and a timer to trigger the method once the constructor is done.
Thank you.public
MyForm(){
// Required for Windows Form Designer support
InitializeComponent();
//TODO: Add any constructor code after InitializeComponent calltimer1.Enabled =true;
}
void MyForm_Method()
{
timer1.Enabled =false;
while(key_pressed == 0)
{
Application.DoEvents();
}
} private void MyForm_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
key_pressed = e.KeyChar;
} private System.Windows.Forms.Timer timer1; int key_pressed=0; private void timer1_Tick(object sender, System.EventArgs e)
{
MyForm_Method();
}