PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
is it the biggest bug in winform?!
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
is it the biggest bug in winform?!
![]() |
is it the biggest bug in winform?! |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
The bug is that in a MDI windows application, when we create serveral
instances of forms with the same shortcut key(I.E. 3 forms, each has a button texted "&Add"), when we press alt-A, we can not be sure which will form receive the key stroke. I don't know if it has been fixed in dotNET Framework SPs, but it is still real existing in my computer and my workmates'. in the following code sample, click the button1 serveral times to create multipile instance of Form2, then try to press 'Alt-A' or 'Alt-M', you can see what a strange behavior winForm brings to us. sample code MDIform, put a button and add the code below: private void button1_Click(object sender, System.EventArgs e) { Form2 f=new Form2(); f.Text="Window" + Convert.ToString(this.MdiChildren.Length+1); f.MdiParent=this; f.Show(); } } create a Form2,put an '&Add' button and a '&Modify' button this.button1.Text = "&Add"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Text = "&Modify"; this.button2.Click += new System.EventHandler(this.button2_Click); private void button1_Click(object sender, System.EventArgs e) { //shows the active windows' caption here MessageBox.Show("button1 clicked in "+ this.Text ); } private void button2_Click(object sender, System.EventArgs e) { MessageBox.Show("button2 clicked in "+ this.Text ); } Any good idea or suggestion will be appreciated, thanks! Tony Yang |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

