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. Visual Basic
  4. RE: I could use some help here

RE: I could use some help here

Scheduled Pinned Locked Moved Visual Basic
questionhelptutorial
10 Posts 7 Posters 1 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.
  • D Offline
    D Offline
    dienadel
    wrote on last edited by
    #1

    I have an example: Form 1: contains 1 textbox and 1 button Question: How can I use the value i inputed on the textbox on form 1 on form 2? Like for example: Form 1: private sub button1_click dim str as string str = textbox1.text end sub Form 2: i want to use the value of str to my form 2. How can I retrieve it?

    C N N L M 5 Replies Last reply
    0
    • D dienadel

      I have an example: Form 1: contains 1 textbox and 1 button Question: How can I use the value i inputed on the textbox on form 1 on form 2? Like for example: Form 1: private sub button1_click dim str as string str = textbox1.text end sub Form 2: i want to use the value of str to my form 2. How can I retrieve it?

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

      dienadel wrote:

      How can I use the value i inputed on the textbox on form 1 on form 2?

      How to pass values between forms[^]

      dienadel wrote:

      i want to use the value of str to my form 2. How can I retrieve it?

      Retrieve it to where? Back to form1? Same process, but in reverse.


      Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

      1 Reply Last reply
      0
      • D dienadel

        I have an example: Form 1: contains 1 textbox and 1 button Question: How can I use the value i inputed on the textbox on form 1 on form 2? Like for example: Form 1: private sub button1_click dim str as string str = textbox1.text end sub Form 2: i want to use the value of str to my form 2. How can I retrieve it?

        N Offline
        N Offline
        Nilesh Hapse
        wrote on last edited by
        #3

        Please go thru this link http://www.codeproject.com/dotnet/passingvaluesbetweenforms.asp

        N 1 Reply Last reply
        0
        • N Nilesh Hapse

          Please go thru this link http://www.codeproject.com/dotnet/passingvaluesbetweenforms.asp

          N Offline
          N Offline
          Nilesh Hapse
          wrote on last edited by
          #4

          OOPS!!! sorry! that link was already posted.... Didn't see it!!!

          1 Reply Last reply
          0
          • D dienadel

            I have an example: Form 1: contains 1 textbox and 1 button Question: How can I use the value i inputed on the textbox on form 1 on form 2? Like for example: Form 1: private sub button1_click dim str as string str = textbox1.text end sub Form 2: i want to use the value of str to my form 2. How can I retrieve it?

            N Offline
            N Offline
            Naji El Kotob
            wrote on last edited by
            #5

            Hi, There are many ways, but this will be a good one: In form 2: Public MyValue As String In form 1: Dim f as new Form2 f.MyValue = str f.Show Now in form 2 you can simple process the value of MyValue variable. Hope this will help! NajiCo http://www.InsideVB.NET[^]

            It's nice 2b important, but it's more important 2b nice...

            C D 2 Replies Last reply
            0
            • N Naji El Kotob

              Hi, There are many ways, but this will be a good one: In form 2: Public MyValue As String In form 1: Dim f as new Form2 f.MyValue = str f.Show Now in form 2 you can simple process the value of MyValue variable. Hope this will help! NajiCo http://www.InsideVB.NET[^]

              It's nice 2b important, but it's more important 2b nice...

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

              Naji El Kotob wrote:

              There are many ways, but this will be a good one

              I'll have to disagree on that one. Destroying encapsulation by making a class field public is rarely a good idea. See these two articles for a discussion on the subject: * Why make fields in a class private, why not just make them public?[^] * The public fields debate again[^]


              Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

              1 Reply Last reply
              0
              • D dienadel

                I have an example: Form 1: contains 1 textbox and 1 button Question: How can I use the value i inputed on the textbox on form 1 on form 2? Like for example: Form 1: private sub button1_click dim str as string str = textbox1.text end sub Form 2: i want to use the value of str to my form 2. How can I retrieve it?

                L Offline
                L Offline
                leckey 0
                wrote on last edited by
                #7

                Please read the forum guidelines. Highlights include making your message title have meaning. Everyone here needs help.

                _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

                P 1 Reply Last reply
                0
                • L leckey 0

                  Please read the forum guidelines. Highlights include making your message title have meaning. Everyone here needs help.

                  _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

                  P Offline
                  P Offline
                  Paul Conrad
                  wrote on last edited by
                  #8

                  leckey wrote:

                  Highlights include making your message title have meaning.

                  Yes. I find that using the < pre > ... < / pre > with the < code > ... < / code > tags makes it much more readable.

                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                  1 Reply Last reply
                  0
                  • D dienadel

                    I have an example: Form 1: contains 1 textbox and 1 button Question: How can I use the value i inputed on the textbox on form 1 on form 2? Like for example: Form 1: private sub button1_click dim str as string str = textbox1.text end sub Form 2: i want to use the value of str to my form 2. How can I retrieve it?

                    M Offline
                    M Offline
                    manni_n
                    wrote on last edited by
                    #9

                    its simple... button1_click() Dim a As New Form2 a.YourPublicMember = TextBox1.Text myform.Show() before loading of form 2 public yourpublicmember as string form2_loads() textbox1.text=yourpublicmember

                    1 Reply Last reply
                    0
                    • N Naji El Kotob

                      Hi, There are many ways, but this will be a good one: In form 2: Public MyValue As String In form 1: Dim f as new Form2 f.MyValue = str f.Show Now in form 2 you can simple process the value of MyValue variable. Hope this will help! NajiCo http://www.InsideVB.NET[^]

                      It's nice 2b important, but it's more important 2b nice...

                      D Offline
                      D Offline
                      dienadel
                      wrote on last edited by
                      #10

                      Thanks man the code is correct. One more thing can i store this value to a properties for example: public properties you() get return textbox.text end get set (byval value as string) textbox.text = value end set

                      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