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
  1. Home
  2. General Programming
  3. C#
  4. Passing datas from one form to anotther in C#.net

Passing datas from one form to anotther in C#.net

Scheduled Pinned Locked Moved C#
csharphelp
6 Posts 5 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.
  • A Offline
    A Offline
    Anu Palavila
    wrote on last edited by
    #1

    Hai I have two forms opened in my mdiparent form I want to pass the value from textbox of 1st form to textbox of the 2nd form I cannot create a new instance of the 2nd form since I want to send to the same opened instance, I tried by changing the property to public but cannot be acessed with out creating a new instace pls help me to pass the values to the same opened instance of the form

    Thanks & Regards

    S C P E 4 Replies Last reply
    0
    • A Anu Palavila

      Hai I have two forms opened in my mdiparent form I want to pass the value from textbox of 1st form to textbox of the 2nd form I cannot create a new instance of the 2nd form since I want to send to the same opened instance, I tried by changing the property to public but cannot be acessed with out creating a new instace pls help me to pass the values to the same opened instance of the form

      Thanks & Regards

      S Offline
      S Offline
      sindhutiwari
      wrote on last edited by
      #2

      declare a variable as static ..........if this doenst works take a class declare static variables in it assing the values to the stat variable while u r in first form then use them in next form.......................please dont mind ...make u r question clear regards sindhu tiwari

      its me sid

      C 1 Reply Last reply
      0
      • S sindhutiwari

        declare a variable as static ..........if this doenst works take a class declare static variables in it assing the values to the stat variable while u r in first form then use them in next form.......................please dont mind ...make u r question clear regards sindhu tiwari

        its me sid

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

        sindhutiwari wrote:

        declare a variable as static

        What if there is more than one instance of the form class?

        sindhutiwari wrote:

        make u r question clear

        What about your answer. For the most part it was a clear as mud.

        Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * The Value of Smaller Methods * Creating Many-to-Many joins My website | blog

        1 Reply Last reply
        0
        • A Anu Palavila

          Hai I have two forms opened in my mdiparent form I want to pass the value from textbox of 1st form to textbox of the 2nd form I cannot create a new instance of the 2nd form since I want to send to the same opened instance, I tried by changing the property to public but cannot be acessed with out creating a new instace pls help me to pass the values to the same opened instance of the form

          Thanks & Regards

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

          This article on passing values between forms[^] might help you.

          Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * The Value of Smaller Methods * Creating Many-to-Many joins My website | blog

          1 Reply Last reply
          0
          • A Anu Palavila

            Hai I have two forms opened in my mdiparent form I want to pass the value from textbox of 1st form to textbox of the 2nd form I cannot create a new instance of the 2nd form since I want to send to the same opened instance, I tried by changing the property to public but cannot be acessed with out creating a new instace pls help me to pass the values to the same opened instance of the form

            Thanks & Regards

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Don't try passing values between forms. A neater architectural approach, is to abstract the data model from the actual visual representation of the value. One way to do this is to implement something called the Model View Controller[^] pattern.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            1 Reply Last reply
            0
            • A Anu Palavila

              Hai I have two forms opened in my mdiparent form I want to pass the value from textbox of 1st form to textbox of the 2nd form I cannot create a new instance of the 2nd form since I want to send to the same opened instance, I tried by changing the property to public but cannot be acessed with out creating a new instace pls help me to pass the values to the same opened instance of the form

              Thanks & Regards

              E Offline
              E Offline
              Elayaraja Sambasivam
              wrote on last edited by
              #6

              have a public variable in mdi window, once you open the child forms, in the form load assign the control to mdi public variables instead of access the form2 text box , access the mdi variable. regards Elayaraja.S

              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