RadioButton and CheckBox confusion...
-
Ok, I have a button event, that when I fire it needs to chedk the states on several CheckBoxes and a pair fo RadioButtons. What I trying to understand is how to set the events to fire after I click the button. Currently when I make a change to one of the CheckBoxes or RadioButtons, it is firing the event under that control. private void btnFind_Click(object sender, System.EventArgs e) { try { int StartPosition; StringComparison SearchType; if (chkMatchCase.Checked == true) { SearchType = StringComparison.Ordinal; } else { SearchType = StringComparison.OrdinalIgnoreCase; } StartPosition = mMain.rtbDoc.Text.IndexOf(txtSearchTerm.Text, SearchType); if (StartPosition == 0) { MessageBox.Show("String: " + txtSearchTerm.Text.ToString() + " not found", "No Matches", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } mMain.rtbDoc.Select(StartPosition, txtSearchTerm.Text.Length); mMain.Focus(); btnFindNext.Enabled = true; mMain.rtbDoc.Select(0, 0); mMain.rtbDoc.ScrollToCaret(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Error"); } } I want to be able to Change the CheckBoxes or RadioButtons and not make the event fire underneath. Thanks,
-
Ok, I have a button event, that when I fire it needs to chedk the states on several CheckBoxes and a pair fo RadioButtons. What I trying to understand is how to set the events to fire after I click the button. Currently when I make a change to one of the CheckBoxes or RadioButtons, it is firing the event under that control. private void btnFind_Click(object sender, System.EventArgs e) { try { int StartPosition; StringComparison SearchType; if (chkMatchCase.Checked == true) { SearchType = StringComparison.Ordinal; } else { SearchType = StringComparison.OrdinalIgnoreCase; } StartPosition = mMain.rtbDoc.Text.IndexOf(txtSearchTerm.Text, SearchType); if (StartPosition == 0) { MessageBox.Show("String: " + txtSearchTerm.Text.ToString() + " not found", "No Matches", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } mMain.rtbDoc.Select(StartPosition, txtSearchTerm.Text.Length); mMain.Focus(); btnFindNext.Enabled = true; mMain.rtbDoc.Select(0, 0); mMain.rtbDoc.ScrollToCaret(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Error"); } } I want to be able to Change the CheckBoxes or RadioButtons and not make the event fire underneath. Thanks,
Add a boolean field to your class that is normally false. In the Click event handlers for the items, check the boolean. If it's false, set it to true and perform the processing, then set it back to false. If it's true, do nothing.
-
Add a boolean field to your class that is normally false. In the Click event handlers for the items, check the boolean. If it's false, set it to true and perform the processing, then set it back to false. If it's true, do nothing.
For the handles, use the CLick method vice CHeckChanged?
-
For the handles, use the CLick method vice CHeckChanged?
Oh, yeah, sorry.