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. form 1 to form 2

form 1 to form 2

Scheduled Pinned Locked Moved C#
tutorialquestion
4 Posts 4 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.
  • G Offline
    G Offline
    ghelhei
    wrote on last edited by
    #1

    how to pass the data from form 1 going to form 2??

    J A 2 Replies Last reply
    0
    • G ghelhei

      how to pass the data from form 1 going to form 2??

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      Here[^]

      1 Reply Last reply
      0
      • G ghelhei

        how to pass the data from form 1 going to form 2??

        A Offline
        A Offline
        AhmedMasum
        wrote on last edited by
        #3

        you can use public static global variable in first forms class (For example form1) and can access that data from next class by(form1.variablename). Another way can be: overload the constructor for form2 with paramater and create object of form2 with parameter from form1

        OriginalGriffO 1 Reply Last reply
        0
        • A AhmedMasum

          you can use public static global variable in first forms class (For example form1) and can access that data from next class by(form1.variablename). Another way can be: overload the constructor for form2 with paramater and create object of form2 with parameter from form1

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          dokhinahaoa wrote:

          you can use public static global variable in first forms class (For example form1) and can access that data from next class by(form1.variablename).

          Never ever suggest that! It is very bad practice to do this: fro example what happens if you need two instances of form2 with different parameters? Rmember we get a lot of beginners reading this forum - we do not want them getting the idea that this is something you should do in the real world! Either pass parameters via the second form constructor, or use events to pass / pick up the data.

          No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          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