.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Getting the main focus back on Main window

Posted By: seattlegirl     Posted Date: November 05, 2011    Points:5   Category :Windows Application
I have 2 winforms.Main form and login form.Main form is an MDI parent.OnLoad in Main form I have disabled some controls.Once I login thru Login form the focus goes back to the Main form but the controls are still disabled.I want to enable the controls once the focus is back on Main Form.

Please help here.

Author: Amit Mehra             
Posted Date: November 09, 2011     Points: 20   


Check the Login form window is closed or not if it is enable the control in the Main form

Hope this helps

Please "Mark As Answer " if this post help you.
Author: Narayanan             
Posted Date: March 09, 2012     Points: 20   

Declare a Boolean value in the Application setting and call the Login form.here an Example:

Application Setting:
ChkFrmclse -- Bool -- user false

In MDI Form :
Member Declare:
bool chkfrm;

create button in the MDI Form and write down the button Click Event
  private void button1_Click(object sender, EventArgs e)
Form1 frm = new Form1();

 private void MDIParent1_Load(object sender, EventArgs e)
chkfrm = Properties.Settings.Default.ChkFrmclse;
if (chkfrm)
newToolStripButton.Enabled = true;
openToolStripButton.Enabled = true;
saveToolStripButton.Enabled = true;

Properties.Settings.Default.ChkFrmclse = false;

In From:
create button in the Form and write down the button Click Event
 private void button1_Click(object sender, EventArgs e)
Properties.Settings.Default.ChkFrmclse = true;
MDIParent1 mdi = new MDIParent1();


I think, It may be useful for your task.It works .

Regards, Lakshmi Naraayanan.S

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend