How to show/call Form2.cs from Form1.cs ? 
Author Message
 How to show/call Form2.cs from Form1.cs ?

Hi

I have Form1.cs and push button inside .
I want to show/call Form2 when the user is click on the push button .

protected void button1_Click (object sender, System.EventArgs e)
  {
        //  CODE  ????
        // In V.B it was :  Form2.Show( ) / Form2.Hide( ) / Form2.Close()
etc ...

Quote:
}

Could some one help me ?
Thanks
Boaz .


Sun, 28 Dec 2003 17:14:16 GMT  
 How to show/call Form2.cs from Form1.cs ?
Boaz,

Here is the way I do it:

private void mnuNewCustomer_Click(object sender, System.EventArgs e)
{
        NewCustomer frm = new NewCustomer();
        frm.ShowDialog(this);

Quote:
}

NewCustomer is the name of the form's class.

Tom



Quote:
>Hi

>I have Form1.cs and push button inside .
>I want to show/call Form2 when the user is click on the push button .

>protected void button1_Click (object sender, System.EventArgs e)
>  {
>        //  CODE  ????
>        // In V.B it was :  Form2.Show( ) / Form2.Hide( ) / Form2.Close()
>etc ...
>}

>Could some one help me ?
>Thanks
>Boaz .

Tom C.

"As night does not come at once, neither does
oppression.  In both instances, there is a twilight
when everything remains unchanged. And it is in that
twilight that we must be most aware of the change in
the air, however slight;  lest we become unwitting
victims of the darkness." -
(US Supreme Court Justice William O. Douglas)



Sun, 28 Dec 2003 19:30:45 GMT  
 How to show/call Form2.cs from Form1.cs ?
In VB we were able to get away with saying Form2.Show()
because VB 6.0 automatically created global instances of
the forms. (Like saying Public Form2 as new Form2)

But starting with .NET, VB has matured from being object
based to object oriented and hence reversed's answer.

Vyas
ICQ: 122201549

Quote:
>-----Original Message-----
>Hi

>I have Form1.cs and push button inside .
>I want to show/call Form2 when the user is click on the
push button .

>protected void button1_Click (object sender,
System.EventArgs e)
>  {
>        //  CODE  ????
>        // In V.B it was :  Form2.Show( ) / Form2.Hide
( ) / Form2.Close()
>etc ...
>}

>Could some one help me ?
>Thanks
>Boaz .

>.



Fri, 02 Jan 2004 16:18:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Form1.cs on new applications

2. Newbie: separate big .cs file into small .cs files

3. Use form1 load form2

4. Trouble accessing Form1.listBox from Form2

5. Calling classes in other cs files

6. Include code in other Cs files

7. Reuse of cs files, namespace, arch advice pls

8. word - automatic numbering/bold/underline/italics

9. How to Generate .cs file at Runtime

10. newbe/cs student, need help w/ code

11. Serial.cs

12. Compile CS source code using ICodeCompiler

 

 
Powered by phpBB® Forum Software