For some really weird reason when i set the .Enabled property to false on a simple text box on a small GUI, it fires a radio buttons OnClick event and its causing lots of problems.
I have breakpointed the txtBox.Enabled = false; and after stepping over OR into it i jump straight to the OnClick event of the radio button control
Here is the call stack as that happened:
TestGUI.exe!TestGUI.frmMain.radiobuttonClicked(object sender = {Text = “Download Single Episode” Checked = true}, System.EventArgs e = {System.EventArgs}) Line 67 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.OnClick(System.EventArgs e) + 0x70 bytes
System.Windows.Forms.dll!System.Windows.Forms.RadioButton.OnClick(System.EventArgs e) + 0x27 bytes
System.Windows.Forms.dll!System.Windows.Forms.RadioButton.OnEnter(System.EventArgs e = {System.EventArgs}) + 0x3e bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.NotifyEnter() + 0x20 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.UpdateFocusedControl() + 0x195 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.AssignActiveControlInternal(System.Windows.Forms.Control value = {Text = “Download Single Episode” Checked = true}) + 0x54 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActivateControlInternal(System.Windows.Forms.Control control, bool originator = false) + 0x76 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.SetActiveControlInternal(System.Windows.Forms.Control value = {Text = “Download Single Episode” Checked = true}) + 0x73 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.SetActiveControl(System.Windows.Forms.Control ctl) + 0x33 bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.ActiveControl.set(System.Windows.Forms.Control value) + 0x5 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Select(bool directed, bool forward) + 0x1b bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.SelectNextControl(System.Windows.Forms.Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) + 0x7b bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.SelectNextControlInternal(System.Windows.Forms.Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) + 0x4a bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.SelectNextIfFocused() + 0x61 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Enabled.set(bool value) + 0x42 bytes
What the hell?
It wouldn’t have anything to do with the way i subscribe to the events would it?
this.radioBtnMultipleDownload.Click += radiobuttonClicked;
this.radioBtnSingleDownload.Click += radiobuttonClicked;
this.radioCustomUrl.Click += radiobuttonClicked;
Second to last line of your call stack:
Apparently,
RadioButtonfiresOnClickedon itsOnEnter, which fires from itsUpdateFocusedControl, which happens because this is the next control. You could try to callControl.Focus()on something else that you want to gain focus before theTextBoxis disabled, so thatSelectNextIfFocused()won’t do anything, ie: