Windows Forms: Toggle Button: in C#
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.
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.
SIGN IN To post a reply.
2 Replies
SD
Suchinder Dhillon
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.
P.S. The only reason I chose a Toggle over RadioButtons is Aesthetic.
SK
Senthil Kumaran Rajan
Syncfusion Team
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#]:
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
Regards,
Senthil
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(); form2.Show(); this.Close(); } else { Form3 form3 = new Form3(); form3.Show(); } } |
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
Regards,
Senthil
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
SD Suchinder Dhillon
- Jan 31, 2016 08:21 AM UTC
- Feb 1, 2016 05:46 PM UTC