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. access variable of form1 in form2

access variable of form1 in form2

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.
  • K Offline
    K Offline
    komal Chhabra
    wrote on last edited by
    #1

    I have a Windows Form Application and I was wondering how to store a user defined variable from a textbox in Form1 and then use the variable in Form2. I am not able to do this. How it will be done?

    S B S 3 Replies Last reply
    0
    • K komal Chhabra

      I have a Windows Form Application and I was wondering how to store a user defined variable from a textbox in Form1 and then use the variable in Form2. I am not able to do this. How it will be done?

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

      make variable public or public static .

      1 Reply Last reply
      0
      • K komal Chhabra

        I have a Windows Form Application and I was wondering how to store a user defined variable from a textbox in Form1 and then use the variable in Form2. I am not able to do this. How it will be done?

        B Offline
        B Offline
        barak160487
        wrote on last edited by
        #3

        in my opinion save the varible and create a property

        1 Reply Last reply
        0
        • K komal Chhabra

          I have a Windows Form Application and I was wondering how to store a user defined variable from a textbox in Form1 and then use the variable in Form2. I am not able to do this. How it will be done?

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          Always a good read regarding the topic: Passing Values between Forms in .NET 1.x with C# and VB.NET examples[^]


          "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

          www.troschuetz.de

          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