Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. RadioButton and CheckBox confusion...

RadioButton and CheckBox confusion...

Scheduled Pinned Locked Moved C#
helptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    solutionsville
    wrote on last edited by
    #1

    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,

    P 1 Reply Last reply
    0
    • S solutionsville

      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,

      P Online
      P Online
      PIEBALDconsult
      wrote on last edited by
      #2

      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.

      S 1 Reply Last reply
      0
      • P PIEBALDconsult

        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.

        S Offline
        S Offline
        solutionsville
        wrote on last edited by
        #3

        For the handles, use the CLick method vice CHeckChanged?

        P 1 Reply Last reply
        0
        • S solutionsville

          For the handles, use the CLick method vice CHeckChanged?

          P Online
          P Online
          PIEBALDconsult
          wrote on last edited by
          #4

          Oh, yeah, sorry.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups