Click here to Skip to main content
16,005,339 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL C#.Net Pin
Alomgir Miah27-Jul-05 6:53
Alomgir Miah27-Jul-05 6:53 
QuestionHow Can I ReBind DataGrid from a Dialogweb Form Pin
boodi_8127-Jul-05 3:27
boodi_8127-Jul-05 3:27 
GeneralRetreiving Attachments from Outlook using Visual C# Pin
SVSP27-Jul-05 3:18
SVSP27-Jul-05 3:18 
GeneralRe: Retreiving Attachments from Outlook using Visual C# Pin
| Muhammad Waqas Butt |27-Jul-05 3:52
professional| Muhammad Waqas Butt |27-Jul-05 3:52 
GeneralUsing nmake on makefiles Pin
Mingzhi_8627-Jul-05 3:12
Mingzhi_8627-Jul-05 3:12 
GeneralMouseWheel Pin
Rassul Yunussov27-Jul-05 3:10
Rassul Yunussov27-Jul-05 3:10 
GeneralChange second form control text Pin
liqnit27-Jul-05 2:59
liqnit27-Jul-05 2:59 
GeneralRe: Change second form control text Pin
Member 146675427-Jul-05 4:56
Member 146675427-Jul-05 4:56 
There are three steps involved in using form to form communication:
1. Create a reference to form2 from form1.
2. Set your reference equal to your instance.
3. Set your control to public.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Since we are dealing with objects here, you have to make sure they know about each other (at least form1 knows about form2). The way to do this is to create a reference to form2 from form1:

public class Form1 : System.Windows.Forms.Form<br />
{<br />
      private Form2 form2 = new Form2();<br />
...}



2. Setting your reference to the instance of form2. Something like this:

private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
    Form2 frm2 = new Form2();<br />
    frm2.Show();<br />
            //This is where you would set you reference equal to your instance.<br />
    form2 = frm2;<br />
}


3. Set the control to public (in form2):

public class Form2 : System.Windows.Forms.Form<br />
{<br />
    public System.Windows.Forms.Button button1;<br />
    ...}


NOTE: your autogenerated code should already have a definition of the button1 but it will be set to private, what you are doing here is changing it to public.


Any question let me know.



Peter Corcoran
peter@corcoranp.com
www.corcoranp.com
GeneralRe: Change second form control text Pin
liqnit27-Jul-05 18:39
liqnit27-Jul-05 18:39 
GeneralUrlEncode in Windows Form Pin
takkung27-Jul-05 0:54
takkung27-Jul-05 0:54 
GeneralRe: UrlEncode in Windows Form Pin
Guffa27-Jul-05 1:28
Guffa27-Jul-05 1:28 
GeneralRe: UrlEncode in Windows Form Pin
sreejith ss nair27-Jul-05 1:30
sreejith ss nair27-Jul-05 1:30 
GeneralGet an object name in any event Pin
Rizwan Bashir27-Jul-05 0:41
Rizwan Bashir27-Jul-05 0:41 
GeneralRe: Get an object name in any event Pin
sreejith ss nair27-Jul-05 1:13
sreejith ss nair27-Jul-05 1:13 
GeneralRe: Get an object name in any event Pin
S. Senthil Kumar27-Jul-05 3:28
S. Senthil Kumar27-Jul-05 3:28 
QuestionHow to achieve successful Encryption in VC++ (using cryptoAPI)and decryption in C#.NET Pin
ameysp27-Jul-05 0:03
ameysp27-Jul-05 0:03 
AnswerRe: How to achieve successful Encryption in VC++ (using cryptoAPI)and decryption in C#.NET Pin
sreejith ss nair27-Jul-05 1:44
sreejith ss nair27-Jul-05 1:44 
GeneralRe: How to achieve successful Encryption in VC++ (using cryptoAPI)and decryption in C#.NET Pin
ameysp27-Jul-05 3:24
ameysp27-Jul-05 3:24 
AnswerRe: How to achieve successful Encryption in VC++ (using cryptoAPI)and decryption in C#.NET Pin
sreejith ss nair27-Jul-05 1:45
sreejith ss nair27-Jul-05 1:45 
GeneralUsing 2 TopLevel forms Pin
liqnit26-Jul-05 22:53
liqnit26-Jul-05 22:53 
GeneralRe: Using 2 TopLevel forms Pin
cshaaaa26-Jul-05 23:29
cshaaaa26-Jul-05 23:29 
GeneralRe: Using 2 TopLevel forms Pin
liqnit27-Jul-05 0:22
liqnit27-Jul-05 0:22 
GeneralRe: Using 2 TopLevel forms Pin
cshaaaa27-Jul-05 0:46
cshaaaa27-Jul-05 0:46 
GeneralRe: Using 2 TopLevel forms Pin
liqnit27-Jul-05 0:58
liqnit27-Jul-05 0:58 
GeneralString is not in correct format Pin
lovelylooney26-Jul-05 22:52
lovelylooney26-Jul-05 22:52 

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.