Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. pass data from runtime created form to main form.

pass data from runtime created form to main form.

Scheduled Pinned Locked Moved C#
csharpwinformshelp
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    redspiderke
    wrote on last edited by
    #1

    Hi, I need to build a application where I have a mainform and multiple runtime generated forms. There are many good methods to pass data between 2 winforms but I have a problem to get it work with runtime generated forms. Is there someone who have a simple sample where i can start from. Thanks

    C 1 Reply Last reply
    0
    • R redspiderke

      Hi, I need to build a application where I have a mainform and multiple runtime generated forms. There are many good methods to pass data between 2 winforms but I have a problem to get it work with runtime generated forms. Is there someone who have a simple sample where i can start from. Thanks

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      redspiderke wrote:

      There are many good methods to pass data between 2 winforms but I have a problem to get it work with runtime generated forms.

      I don't quite understand what you mean. What is the difference between a "winform" and a "runtime generated form"?

      Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

      R 1 Reply Last reply
      0
      • C Colin Angus Mackay

        redspiderke wrote:

        There are many good methods to pass data between 2 winforms but I have a problem to get it work with runtime generated forms.

        I don't quite understand what you mean. What is the difference between a "winform" and a "runtime generated form"?

        Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

        R Offline
        R Offline
        redspiderke
        wrote on last edited by
        #3

        Sorry,with a winform I mean a standard form :-)

        C 1 Reply Last reply
        0
        • R redspiderke

          Sorry,with a winform I mean a standard form :-)

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          What is a "standard form"? You have to explain what you mean by both things because I still don't know what you mean.

          Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

          R 1 Reply Last reply
          0
          • C Colin Angus Mackay

            What is a "standard form"? You have to explain what you mean by both things because I still don't know what you mean.

            Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

            R Offline
            R Offline
            redspiderke
            wrote on last edited by
            #5

            Hi Colin, A Standard form is just a form you make with the interface from Visual Studio(the basic Form1.cs in a new solution for example). The runtime form is a form that I totaly create from code when i hit a button. private void button2_Click(object sender, EventArgs e) { Form frmRuntime = new Form(); frmRuntime.Show(); } In realtime i have a form frmMain with a couple of buttons. Each button opens a form that is not visible in my solution explorer but is generated 100% from code. The problem is that I want pass de data (textboxes) from the code generated form to the main form (frmMain).

            C 1 Reply Last reply
            0
            • R redspiderke

              Hi Colin, A Standard form is just a form you make with the interface from Visual Studio(the basic Form1.cs in a new solution for example). The runtime form is a form that I totaly create from code when i hit a button. private void button2_Click(object sender, EventArgs e) { Form frmRuntime = new Form(); frmRuntime.Show(); } In realtime i have a form frmMain with a couple of buttons. Each button opens a form that is not visible in my solution explorer but is generated 100% from code. The problem is that I want pass de data (textboxes) from the code generated form to the main form (frmMain).

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              redspiderke wrote:

              The problem is that I want pass de data (textboxes) from the code generated form to the main form (frmMain).

              They will be somewhere in the Controls collection? So long as you have uniquely identified them (use the Name property), you can use the Find method on the ControlCollection For example:

              myForm.Controls.Find("MyTextBox");

              NOTE: The above line of code will return an array of Control objects because it is possible to have multiple controls with the same name.

              Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) - (part 3) My website | Blog

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups