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 textbox value one form to another form..

passing textbox value one form to another form..

Scheduled Pinned Locked Moved C#
7 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.
  • M Offline
    M Offline
    Mads115
    wrote on last edited by
    #1

    Hi I am creating a windows application, it has two Forms one is Login Form which has two textBox Control for user name and password..... i want to display his username in the Second Form label Control..... Please give Some idea Thanks in advance

    H D 2 Replies Last reply
    0
    • M Mads115

      Hi I am creating a windows application, it has two Forms one is Login Form which has two textBox Control for user name and password..... i want to display his username in the Second Form label Control..... Please give Some idea Thanks in advance

      H Offline
      H Offline
      Hema Bairavan
      wrote on last edited by
      #2

      hoh sorry.. i am working in WPF .net 3.5. i was replied in that mood. it will work there.. extremly sorry mads115.. here better u may can use that in constructors, or by giving in the properties or in the public string and all

      modified on Monday, June 1, 2009 7:04 AM

      M N 2 Replies Last reply
      0
      • M Mads115

        Hi I am creating a windows application, it has two Forms one is Login Form which has two textBox Control for user name and password..... i want to display his username in the Second Form label Control..... Please give Some idea Thanks in advance

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #3

        1. Properties 2. Parameterized constructors Is this much hint enough?

        जय हिंद Rajdeep.Net[^] is NOT from India. Proof.[^]

        1 Reply Last reply
        0
        • H Hema Bairavan

          hoh sorry.. i am working in WPF .net 3.5. i was replied in that mood. it will work there.. extremly sorry mads115.. here better u may can use that in constructors, or by giving in the properties or in the public string and all

          modified on Monday, June 1, 2009 7:04 AM

          M Offline
          M Offline
          Mads115
          wrote on last edited by
          #4

          Hi iam getting this error near label1 'WindowsApplication1.Form2.label1' is inaccessible due to its protection level' Form2 newform = new Form2(); newform.label1.Text = this.textBox1.Text;

          N D 2 Replies Last reply
          0
          • H Hema Bairavan

            hoh sorry.. i am working in WPF .net 3.5. i was replied in that mood. it will work there.. extremly sorry mads115.. here better u may can use that in constructors, or by giving in the properties or in the public string and all

            modified on Monday, June 1, 2009 7:04 AM

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            Hema Bairavan wrote:

            form2 newform = new form2(); newform.label1.text = this.textbox1; newform.label2.text = this.textbox2;

            WOW! That's really bad.

            Navaneeth How to use google | Ask smart questions

            1 Reply Last reply
            0
            • M Mads115

              Hi iam getting this error near label1 'WindowsApplication1.Form2.label1' is inaccessible due to its protection level' Form2 newform = new Form2(); newform.label1.Text = this.textBox1.Text;

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              Colin has an article on the subject - Passing Values between Forms in .NET 1.x with C# and VB.NET examples[^] :)

              Navaneeth How to use google | Ask smart questions

              1 Reply Last reply
              0
              • M Mads115

                Hi iam getting this error near label1 'WindowsApplication1.Form2.label1' is inaccessible due to its protection level' Form2 newform = new Form2(); newform.label1.Text = this.textBox1.Text;

                D Offline
                D Offline
                DaveyM69
                wrote on last edited by
                #7

                You will as the controls are private - which is as they should be. Better to create your own public properties and in the setters, validate the value if neeeded and uptdate the controls from there.

                Dave
                BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
                Why are you using VB6? Do you hate yourself? (Christian Graus)

                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