473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to enable form1 when form2 closed if form1 was disabled in redirecting to form2

1
Hi,
I have two forms(form1 and form2). I placed a button in form1 to redirect to form2. now my question is if i click the button form2 is displayed and form1 is disabled and if i close the form2 it closes and form1 is again enabled. its my intention to do. so any one pleas help me in this regard please send me the sample code to do.
Thank you.
Mar 21 '11 #1
1 2933
adriancs
122 100+
Maybe this can solve your problem. Try this:
Expand|Select|Wrap|Line Numbers
  1. Button button1 = new Button();
  2. button1.Location = new Point(100, 100);
  3. button1.Text = "button1";
  4. button1.Click += new EventHandler(button1_Click);
  5. this.Controls.Add(button2);
  6.  
  7. private void button1_Click(object sender, EventArgs e)
  8. {
  9.     this.Visible = false;
  10.     Form2 f = new Form2();
  11.     f.ShowDialog();
  12.     this.Visible = true;
  13. }
Apr 30 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tom | last post by:
Hi Everybod I want to update some controls in a form from another threads. I did it by passing the form to that thread and calling a delegate with Form1.Invoke, I want to have just one delegeate...
0
by: Kitchen Bin | last post by:
HELP PLEASE!! The C# Visual Studio IDE is failing to load an inherited form into the IDE from a base form when I add items to an array property of a user control on the base form. That sounds...
5
by: nadir b | last post by:
hi I don't know how to change for exemple a form1 caption text from form2 don't forget that form2 has created from form1 I want sample code with c# *** Sent via Developersdex...
4
by: Ken Varn | last post by:
I am trying to cut down the amount ViewState data that is passed to the client browser. I have a number of Web Server Controls on my page, but I am confused as to when ViewState can be disabled to...
5
by: meenasamy | last post by:
Hi all i have used a script that i downloaded and uses the fopen($url,'r'); function to access a url to retrieve data and i get this error Fatal error: fopen(): Unable to find the wrapper...
3
by: R. Harris | last post by:
Hi. I have 2 forms: form1 form2 On Form2 I have a listbox and a button. When I click the button it calls a function from form1 and within that function it updates the listbox on form2. My...
4
by: ShayHk | last post by:
I want to Open Form2 from Form1 when Button pressed. When Form2 Opens I want it to be opened in the same window..but diffrent login ... Like Explorer.
1
by: mmr315 | last post by:
how to destroy session when browser closed with out logout.pls hlp me
1
by: ssknov | last post by:
Hi all any bdy pls tell me how to access textbox control in Form2 from Form1 thanks in advance ssk
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.