?
Solved

Windows appication question

Posted on 2006-05-02
3
Medium Priority
?
193 Views
Last Modified: 2010-04-16
Hi,
I have a windows form (C# )and i have a button in there and when clicked it should close the current form and display another form (form2). How do i do that?
0
Comment
Question by:jyotishb
  • 2
3 Comments
 
LVL 10

Expert Comment

by:rivusglobal
ID: 16589967
You could do something like this:

        private void button_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form2 frm = new Form2();
            frm.Show();
        }
0
 

Author Comment

by:jyotishb
ID: 16590165
I got it..

i did something like this

private Form3 fm= new Form3();

 private void button_Click(object sender, EventArgs e)
 {
      fm.showdialog();
  }
0
 
LVL 10

Accepted Solution

by:
rivusglobal earned 1500 total points
ID: 16590245
If you use showdialog, you can also add your initial form as the owner of the second. Ex. frm2.showdialog(frm1)

You can pass objects between forms this way.

Glad to hear you got things working.

Cheers!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question