form1 and form2

Discussion in 'Microsoft Dot NET Framework Forms' started by james ou, Nov 5, 2003.

  1. james ou

    james ou Guest

    Hi,

    I create a form2 in the form1. Can I change some data
    of form1 in the form2?

    Thanks
     
    james ou, Nov 5, 2003
    #1
    1. Advertisements

  2. james ou

    Jeff Yang Guest

    Maybe its better to show your source code first,so we can grasp your meaning
    better.

    "james ou" <>
    ??????:0bf401c3a386$d9ea1e10$...
    > Hi,
    >
    > I create a form2 in the form1. Can I change some data
    > of form1 in the form2?
    >
    > Thanks
     
    Jeff Yang, Nov 5, 2003
    #2
    1. Advertisements

  3. * "james ou" <> scripsit:
    > I create a form2 in the form1. Can I change some data
    > of form1 in the form2?


    Are you talking about MDI forms?

    --
    Herfried K. Wagner
    MVP · VB Classic, VB.NET
    <http://www.mvps.org/dotnet>

    <http://www.plig.net/nnq/nquote.html>
     
    Herfried K. Wagner [MVP], Nov 5, 2003
    #3
  4. james ou

    Tom Clement Guest

    Yes. One way is to set the Modifiers property of any control you want to
    access on form1 to Internal or Public. Make sure you pass a reference to
    form1 into form2, then, for example, use the line:
    form1.TextBox1.Text = "NewText";
    Tom Clement

    "james ou" <> wrote in message
    news:0bf401c3a386$d9ea1e10$...
    > Hi,
    >
    > I create a form2 in the form1. Can I change some data
    > of form1 in the form2?
    >
    > Thanks
     
    Tom Clement, Nov 6, 2003
    #4
  5. james ou

    james ou Guest

    In the form1, have a button to be clicked to create form2,
    and in the form2, have a textbox to let user input some
    data.Is there some way to let the form1 receive the input
    data or to change some variable(data) in the form1 after
    user input some data in the form2?


    >-----Original Message-----
    >Maybe its better to show your source code first,so we can

    grasp your meaning
    >better.
    >
    >"james ou" <>
    >??????:0bf401c3a386$d9ea1e10$...
    >> Hi,
    >>
    >> I create a form2 in the form1. Can I change some data
    >> of form1 in the form2?
    >>
    >> Thanks

    >
    >
    >.
    >
     
    james ou, Nov 6, 2003
    #5
  6. james ou

    james ou Guest

    Thanks Tom, how can I pass a reference to form1 into
    form2?


    >-----Original Message-----
    >Yes. One way is to set the Modifiers property of any

    control you want to
    >access on form1 to Internal or Public. Make sure you

    pass a reference to
    >form1 into form2, then, for example, use the line:
    > form1.TextBox1.Text = "NewText";
    >Tom Clement
    >
    >"james ou" <> wrote in

    message
    >news:0bf401c3a386$d9ea1e10$...
    >> Hi,
    >>
    >> I create a form2 in the form1. Can I change some data
    >> of form1 in the form2?
    >>
    >> Thanks

    >
    >
    >.
    >
     
    james ou, Nov 6, 2003
    #6
  7. james ou

    Tom Clement Guest

    Maybe something like this (in C#):

    In form2 -- start code --

    private form1 m_frmForm1;
    internal form1 MyForm1 {set { m_frmForm1 = value;}}

    .....
    {
    ...
    m_frmForm1.TextBox1.Text = "New Text";
    }

    form2 -- end code --

    now in form1 -- start code --
    .....
    form2 myForm2 = new myForm2();
    myForm2.MyForm1 = this;

    form1 -- end code --


    "james ou" <> wrote in message
    news:06a901c3a42e$d2c9fe90$...
    > Thanks Tom, how can I pass a reference to form1 into
    > form2?
    >
    >
    > >-----Original Message-----
    > >Yes. One way is to set the Modifiers property of any

    > control you want to
    > >access on form1 to Internal or Public. Make sure you

    > pass a reference to
    > >form1 into form2, then, for example, use the line:
    > > form1.TextBox1.Text = "NewText";
    > >Tom Clement
    > >
    > >"james ou" <> wrote in

    > message
    > >news:0bf401c3a386$d9ea1e10$...
    > >> Hi,
    > >>
    > >> I create a form2 in the form1. Can I change some data
    > >> of form1 in the form2?
    > >>
    > >> Thanks

    > >
    > >
    > >.
    > >
     
    Tom Clement, Nov 6, 2003
    #7
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. A-PK

    Form2 alwasy on Form1

    A-PK, Mar 11, 2004, in forum: Microsoft Dot NET Framework Forms
    Replies:
    5
    Views:
    618
    Stoitcho Goutsev \(100\) [C# MVP]
    Mar 12, 2004
  2. A-PK

    Form2 Open and Fill in Form1 Panel

    A-PK, Mar 12, 2004, in forum: Microsoft Dot NET Framework Forms
    Replies:
    8
    Views:
    436
    David Clegg
    Mar 12, 2004
  3. A-PK
    Replies:
    0
    Views:
    316
  4. Chris Dunaway

    Problem with control form1's object from form2

    Chris Dunaway, Jul 30, 2004, in forum: Microsoft Dot NET Framework Forms
    Replies:
    2
    Views:
    200
    Umut ERGÜN
    Aug 1, 2004
  5. Guest

    open windows form2 within windows form1

    Guest, Mar 13, 2006, in forum: Microsoft Dot NET Framework Forms
    Replies:
    3
    Views:
    235
    Tim Wilson
    Mar 13, 2006
Loading...

Share This Page