Click here to Skip to main content
15,891,657 members
Home / Discussions / C#
   

C#

 
GeneralRe: sub forms ?? Pin
Software_Specialist2-Aug-07 23:59
Software_Specialist2-Aug-07 23:59 
GeneralRe: sub forms ?? Pin
Rudolf Jan3-Aug-07 0:26
Rudolf Jan3-Aug-07 0:26 
GeneralRe: sub forms ?? Pin
Software_Specialist3-Aug-07 1:42
Software_Specialist3-Aug-07 1:42 
GeneralRe: sub forms ?? Pin
Sam_c3-Aug-07 2:24
Sam_c3-Aug-07 2:24 
GeneralRe: sub forms ?? Pin
Software_Specialist3-Aug-07 2:58
Software_Specialist3-Aug-07 2:58 
GeneralRe: sub forms ?? Pin
Rudolf Jan5-Aug-07 10:25
Rudolf Jan5-Aug-07 10:25 
GeneralRe: sub forms ?? Pin
Software_Specialist3-Aug-07 0:22
Software_Specialist3-Aug-07 0:22 
GeneralRe: sub forms ?? [modified] Pin
Sam_c3-Aug-07 2:04
Sam_c3-Aug-07 2:04 
Lots wrong there.

in form2.cs

public partial class Form2 : Form
   {
       private Form frmParent;  //Notice FORM as base
       public Form2(Form objForm) //Passing the Parent Form via Construct
       {
           InitializeComponent();
           frmParent = objForm;   //Assigning Parent forms (this) to frmParent param
       }

       private void button1_Click(object sender, EventArgs e)
       {
           frmParent.Show();   //Show then Close.
           this.Close();
       }
   }


In Form1.cs

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        Form2 objForm = new Form2(this); //pass this form to form2
        this.Hide(); //Hide first due to single thread
        objForm.ShowDialog(); //show form2
    }
}





-- modified at 8:12 Friday 3rd August, 2007
modified decided to spell it out after reading other posts



GeneralRe: sub forms ?? Pin
Software_Specialist3-Aug-07 2:17
Software_Specialist3-Aug-07 2:17 
QuestionDatagridview cursor focus Pin
praveenkumar palla2-Aug-07 4:57
praveenkumar palla2-Aug-07 4:57 
AnswerRe: Datagridview cursor focus Pin
Judah Gabriel Himango2-Aug-07 5:12
sponsorJudah Gabriel Himango2-Aug-07 5:12 
GeneralRe: Datagridview cursor focus Pin
praveenkumar palla2-Aug-07 5:38
praveenkumar palla2-Aug-07 5:38 
GeneralRe: Datagridview cursor focus Pin
Judah Gabriel Himango2-Aug-07 6:05
sponsorJudah Gabriel Himango2-Aug-07 6:05 
QuestionAdding Pictures to program Pin
Bonsta2-Aug-07 4:43
Bonsta2-Aug-07 4:43 
AnswerRe: Adding Pictures to program Pin
Judah Gabriel Himango2-Aug-07 5:10
sponsorJudah Gabriel Himango2-Aug-07 5:10 
QuestionShow an integer property as hexadecimal in a property grid Pin
FDK22-Aug-07 4:08
FDK22-Aug-07 4:08 
AnswerRe: Show an integer property as hexadecimal in a property grid Pin
Martin#2-Aug-07 4:11
Martin#2-Aug-07 4:11 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
FDK22-Aug-07 10:54
FDK22-Aug-07 10:54 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
Martin#2-Aug-07 19:55
Martin#2-Aug-07 19:55 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
FDK22-Aug-07 20:56
FDK22-Aug-07 20:56 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
Martin#2-Aug-07 21:06
Martin#2-Aug-07 21:06 
AnswerRe: Show an integer property as hexadecimal in a property grid Pin
pmarfleet2-Aug-07 4:12
pmarfleet2-Aug-07 4:12 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
FDK22-Aug-07 10:55
FDK22-Aug-07 10:55 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
pmarfleet2-Aug-07 11:32
pmarfleet2-Aug-07 11:32 
GeneralRe: Show an integer property as hexadecimal in a property grid Pin
FDK22-Aug-07 11:48
FDK22-Aug-07 11:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.