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


Top 5 Contributors of the Month
david stephan

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.

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

Hi,

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

Hope this helps

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

Hi,
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();
frm.Show();
this.Hide();
}

 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;
Properties.Settings.Default.Save();
}

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;
Properties.Settings.Default.Save();
MDIParent1 mdi = new MDIParent1();
mdi.Show();
this.Hide();

}



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


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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