Results 1 to 3 of 3

Thread: [3.0/LINQ] Receiving Text from Different Form?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Posts
    207

    [3.0/LINQ] Receiving Text from Different Form?

    I have two forms. The second form is where I type things in. When I hit ok, how do I send the text in the textbox, to a different textbox on my other form?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [3.0/LINQ] Receiving Text from Different Form?

    You can give the form a property whose value you set from the other form or you can create a delegate which the first form uses to pass the value to the other form.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [3.0/LINQ] Receiving Text from Different Form?

    CSharp Code:
    1. using (Form2 f2 = new Form2())
    2. {
    3.     if (f2.ShowDialog() == DialogResult.OK)
    4.     {
    5.         this.SomeTextBox.Text = f2.SomeStringProperty;
    6.     }
    7. }
    SomeStringProperty is the property that mendhak is talking about, that you declare in Form2:
    CSharp Code:
    1. public string SomeStringProperty
    2. {
    3.     get
    4.     {
    5.         return this.SomeTextBox.Text;
    6.     }
    7. }
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width