We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Windows Forms: Toggle Button: in C#

Thread ID:





121845 Jan 31,2016 08:21 AM UTC Feb 1,2016 05:46 PM UTC WinForms 2
Tags: ToggleButton
Suchinder Dhillon
Asked On January 31, 2016 08:21 AM UTC

First off, I am new to SyncFusion and am totally blown away by the offering here. Within 24 hours of starting to explore the controls and playing with coding, I had added a special thanks, control copyright, and please patronize statement to my splash screen and in code <Remark> </Remark> Blocks. My application will be used among a pretty dedicated set of coders, perhaps 10,000 from all over the world.

My question today deals with the toggle switch. I have my "toggle switch" set up within a "advanced panel" within a Standard WinForm. I also have a button on the same page.

The flow for my interaction is that a user selects on/off on the toggle button and then hit the regular button.

In code, the user selecting an option should either trigger a value that can be saved in a strString. Pressing the button on the page will trigger and if, then, else that will read the string and compare it to a constant. It the comparison is positive then a then will close this first form and open a second form. The first form must be closed, not hidden. If the comparison is Negative then a tertiary form opens like the second in the first example.

Any help will be appreciated and Thanks in advance.

Suchinder Dhillon
Replied On January 31, 2016 06:00 PM UTC

Sorry I was very tired when I wrote the last part of that. I need activation of the toggile to trigger some kind of action that can be stored in an event. This can be likened to selecting one of two radio buttons and then reading the state of the radiobuttons. I am new to toggles so do not know if this works with them. The toggle must only change a state in a way that I can read it later. Then when a different button_click is executed, I will need the code to read all these variables and determine what location to go too. Thanks in advance for any assistance.

P.S. The only reason I chose a Toggle over RadioButtons is Aesthetic.

Senthil Kumaran Rajan [Syncfusion]
Replied On February 1, 2016 05:46 PM UTC

Hi Suchinder,

Thanks for contacting Syncfusion Support.

The reported requirement can be achieved by ensuring the Tooglestate of the ToogleButton. Please make use of the below code example.

Code Example[C#]:

private void buttonAdv1_Click(object sender, EventArgs e)


            if (this.toggleButton1.ToggleState == ToggleButtonState.Active)


                Form2 form2 = new Form2();






                Form3 form3 = new Form3();





We have prepared a sample for your reference and it can be downloaded from the below location.

Sample : http://www.syncfusion.com/downloads/support/forum/121845/TOGGLE~1-1536896225.ZIP

Could you check with the above solution and let us know whether the provided solution helps to achieve the reported requirement? If not could you please share us some additional details about the reported requirement, it will be helpful for us to analyze and provide you the prompt solution as early as possible.

Please refer the below UG Documentation like for further reference.

UG Link : http://help.syncfusion.com/windowsforms/togglebutton/overview



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon