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. Not sure how to phrase this....

Not sure how to phrase this....

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
10 Posts 6 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.
  • S Offline
    S Offline
    svanwass
    wrote on last edited by
    #1

    I have a string variable which contains the name of a textbox whose text I want to get/use. How can I I create a textbox object from my variable and get the text? Thanks! -Steve

    C C G 3 Replies Last reply
    0
    • S svanwass

      I have a string variable which contains the name of a textbox whose text I want to get/use. How can I I create a textbox object from my variable and get the text? Thanks! -Steve

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Reflection.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      S 2 Replies Last reply
      0
      • C Christian Graus

        Reflection.

        Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        S Offline
        S Offline
        svanwass
        wrote on last edited by
        #3

        If i didn't know how to phrase it for a forum, how would i know how to phrase it for a search engine? Useful keywords would have helped more than a post on how to use Google.

        C S 2 Replies Last reply
        0
        • S svanwass

          If i didn't know how to phrase it for a forum, how would i know how to phrase it for a search engine? Useful keywords would have helped more than a post on how to use Google.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          I'm sorry. I'm sorry you're so stupid. The link to google is, in fact, my sig block. My answer was actually one word. Reflection. Google reflection and you'll drown in examples on how to do what you want.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          1 Reply Last reply
          0
          • S svanwass

            If i didn't know how to phrase it for a forum, how would i know how to phrase it for a search engine? Useful keywords would have helped more than a post on how to use Google.

            S Offline
            S Offline
            Shog9 0
            wrote on last edited by
            #5

            svanwass wrote:

            If i didn't know how to phrase it for a forum, how would i know how to phrase it for a search engine?

            Chill, dude. When in doubt, explain what you're actually trying to do - not how you think you're gonna do it. And ask follow-up questions.

            Citizen 20.1.01

            'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

            1 Reply Last reply
            0
            • S svanwass

              I have a string variable which contains the name of a textbox whose text I want to get/use. How can I I create a textbox object from my variable and get the text? Thanks! -Steve

              C Offline
              C Offline
              Chinners
              wrote on last edited by
              #6

              You could try: with directcast(me.controls(StringName),textbox) .Text="Blah" end with Although you will have to be sure that the control exists, or you will get an exception.

              1 Reply Last reply
              0
              • S svanwass

                I have a string variable which contains the name of a textbox whose text I want to get/use. How can I I create a textbox object from my variable and get the text? Thanks! -Steve

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                The solution has already been suggested, but whenever you need reflection to do something, you are either doing something quite advanced, or you are doing something backwards... Why is it that you have a name of a textbox, instead of a reference to it? What is it that you are trying to accomplish really?

                Despite everything, the person most likely to be fooling you next is yourself.

                S 1 Reply Last reply
                0
                • C Christian Graus

                  Reflection.

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  S Offline
                  S Offline
                  svanwass
                  wrote on last edited by
                  #8

                  My apologies Christian. I misread your answer.

                  1 Reply Last reply
                  0
                  • G Guffa

                    The solution has already been suggested, but whenever you need reflection to do something, you are either doing something quite advanced, or you are doing something backwards... Why is it that you have a name of a textbox, instead of a reference to it? What is it that you are trying to accomplish really?

                    Despite everything, the person most likely to be fooling you next is yourself.

                    S Offline
                    S Offline
                    svanwass
                    wrote on last edited by
                    #9

                    My program connects to a database which populates a bunch of text boxes. I then unlock them and allow the user to edit the contents. A write button is pressed and the contents of the current text boxes are stored in an array and compared to the original database read (stored in a different array) to determine what has been changed. The position at which a change is found is store in another array. These positions correlates to another array that stores the names of the text boxes. The step i am missing is to take that stored text box name and get the real text boxes text.

                    S 1 Reply Last reply
                    0
                    • S svanwass

                      My program connects to a database which populates a bunch of text boxes. I then unlock them and allow the user to edit the contents. A write button is pressed and the contents of the current text boxes are stored in an array and compared to the original database read (stored in a different array) to determine what has been changed. The position at which a change is found is store in another array. These positions correlates to another array that stores the names of the text boxes. The step i am missing is to take that stored text box name and get the real text boxes text.

                      S Offline
                      S Offline
                      Steven St John
                      wrote on last edited by
                      #10

                      ...so that you can then store the changed values in the database? But don't you already have the values? Isn't the position of a changed text item also the index of the array that you first used, when the user clicks the Write button, to store what was in the text boxes? Why read from the text boxes when you can read from your array's copy of the text boxes?

                      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