| | |
Check Whether Button Clicked or not - Please Help
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Jun 2009
Posts: 67
Reputation:
Solved Threads: 0
Hi all,
I am creating an Windows application.
I have 2 forms.
In First form I have two buttons. The Second Buttons Enabled property is set to False.
If the First button is clicked then Form 2 should be shown which I have done with the Coding.
In the second Form I have one button If this button is clicked then it should show first form and the second button of that form should be enabled (Enabled property to be set to TRUE).
Can anyone help me out in doing this task?
Please help me out.
Thanks in advance!!
I am creating an Windows application.
I have 2 forms.
In First form I have two buttons. The Second Buttons Enabled property is set to False.
If the First button is clicked then Form 2 should be shown which I have done with the Coding.
In the second Form I have one button If this button is clicked then it should show first form and the second button of that form should be enabled (Enabled property to be set to TRUE).
Can anyone help me out in doing this task?
Please help me out.
Thanks in advance!!
Form1:
Form2:
c# Syntax (Toggle Plain Text)
using System; using System.Windows.Forms; namespace daniweb { public partial class frm1 : Form { public frm1() { InitializeComponent(); } public void EnableButton2() { button2.Enabled = true; } private void frm1_Load(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = false; } private void button1_Click(object sender, EventArgs e) { new frm2().Show(); //this.Hide(); } private void button2_Click(object sender, EventArgs e) { //Dont know what you want to do } } }
Form2:
c# Syntax (Toggle Plain Text)
using System; using System.Windows.Forms; namespace daniweb { public partial class frm2 : Form { public frm2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { frm1 f = GetMainForm(); if (f == null) return; f.EnableButton2(); //this.Hide(); f.BringToFront(); f.Focus(); } private static frm1 GetMainForm() { for (int i1 = 0; i1 < Application.OpenForms.Count; i1++) { if (Application.OpenForms[i1] is frm1) return ((frm1)Application.OpenForms[i1]); } return null; } } }
![]() |
Similar Threads
- Unable to preform queries within one button (PHP)
- Remove textfield when button is clicked (JavaScript / DHTML / AJAX)
- How to check if a button was clicked ? (VB.NET)
- count how often a button is clicked python/tk (Python)
- display image when button clicked (Java)
- Get visual basic to bring up another form when a button is clicked (Visual Basic 4 / 5 / 6)
Other Threads in the C# Forum
- Previous Thread: Lines per Day
- Next Thread: Use of List<int[]>
| Thread Tools | Search this Thread |
.net access ado.net algorithm array bitmap box buttons c# check checkbox client combobox connection console contorl control conversion cryptographyc#winformsencryption csharp database datagrid datagridview dataset datetime degrees deployment disabled displayingopenforms draganddrop drawing editor encryption enum excel file form format forms ftp function gdi+ hospitalmanagementinformationsystem i18n image imageprocessing index-error input install java label list listbox math mathematics mouseclick mysql operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remoting richtextbox rows serialization server setup sleep socket sql statistics stream string table temperature text textbox thread time timer totaldays update uploadatextfile user usercontrol validation visualstudio webbrowser whileloop windowsformsapplication winforms wpf xml






