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. The Lounge
  3. Dynamic Variable declaration

Dynamic Variable declaration

Scheduled Pinned Locked Moved The Lounge
helptutorialquestion
16 Posts 13 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.
  • C Chamu Matumbura

    Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

    Reuse! Buy If You Can! Build If You Must

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #2

    Chamu Matumbura wrote:

    I want to know if it is possible to declare variables at runtime in VB.

    No Still no Still no Answer aint gonna change in here!

    xacc.ide
    IronScheme - 1.0 beta 4 - out now!
    ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

    1 Reply Last reply
    0
    • C Chamu Matumbura

      Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

      Reuse! Buy If You Can! Build If You Must

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #3

      1. Look up approx 2 inches 2. Read the notice that says "Please do not post programming questions here." [edit] it could be argued the VB isn't programming I suppose 3. Click the link next to it and post in the correct forum This forum is for people who are avoiding taking a break from work

      1 Reply Last reply
      0
      • C Chamu Matumbura

        Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

        Reuse! Buy If You Can! Build If You Must

        S Offline
        S Offline
        Steve Dubyo
        wrote on last edited by
        #4

        Wow, this isn't going to end well.

        ;-]

        J 1 Reply Last reply
        0
        • S Steve Dubyo

          Wow, this isn't going to end well.

          ;-]

          J Offline
          J Offline
          Jim Crafton
          wrote on last edited by
          #5

          Are you using your high midichlorian count to help ascertain this? Or just a lucky guess? :)

          ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

          D S 2 Replies Last reply
          0
          • C Chamu Matumbura

            Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

            Reuse! Buy If You Can! Build If You Must

            N Offline
            N Offline
            NormDroid
            wrote on last edited by
            #6

            :laugh: :laugh: :laugh: :laugh: :laugh: :laugh: :laugh: :laugh: :laugh: :laugh: It's the way you tell 'em.

            Software Kinetics (requires SL3 beta) - Moving software

            1 Reply Last reply
            0
            • C Chamu Matumbura

              Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

              Reuse! Buy If You Can! Build If You Must

              D Offline
              D Offline
              Dalek Dave
              wrote on last edited by
              #7

              Flame on! If you cannot read why are you attempting to program?

              ------------------------------------ "Men may make bad decisions, immoral decisions or just plain wrong decisions, but at least they make decisions. Women on the other hand..." Patrick Kielty 2006

              1 Reply Last reply
              0
              • J Jim Crafton

                Are you using your high midichlorian count to help ascertain this? Or just a lucky guess? :)

                ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

                D Offline
                D Offline
                Dalek Dave
                wrote on last edited by
                #8

                I gotta bad feeling about this!

                ------------------------------------ "Men may make bad decisions, immoral decisions or just plain wrong decisions, but at least they make decisions. Women on the other hand..." Patrick Kielty 2006

                L 1 Reply Last reply
                0
                • J Jim Crafton

                  Are you using your high midichlorian count to help ascertain this? Or just a lucky guess? :)

                  ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

                  S Offline
                  S Offline
                  Steve Dubyo
                  wrote on last edited by
                  #9

                  Just a wild stab in the dark but I'm feeling lucky!!

                  ;-]

                  1 Reply Last reply
                  0
                  • D Dalek Dave

                    I gotta bad feeling about this!

                    ------------------------------------ "Men may make bad decisions, immoral decisions or just plain wrong decisions, but at least they make decisions. Women on the other hand..." Patrick Kielty 2006

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    I've got a good feeling about it because I know why you've got a bad feeling about it. :laugh:

                    Visit http://www.notreadytogiveup.com/[^] and do something special today.

                    1 Reply Last reply
                    0
                    • C Chamu Matumbura

                      Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

                      Reuse! Buy If You Can! Build If You Must

                      D Offline
                      D Offline
                      Dave Parker
                      wrote on last edited by
                      #11

                      Maybe I'm misunderstanding what you're trying to do, but use an array?

                      1 Reply Last reply
                      0
                      • C Chamu Matumbura

                        Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

                        Reuse! Buy If You Can! Build If You Must

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        You aren't making any.

                        Chamu Matumbura wrote:

                        Here is the logic

                        I'm afraid not.

                        1 Reply Last reply
                        0
                        • C Chamu Matumbura

                          Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

                          Reuse! Buy If You Can! Build If You Must

                          M Offline
                          M Offline
                          Marc Clifton
                          wrote on last edited by
                          #13

                          Use XML. That should solve the problem. ;) Marc

                          Will work for food. Interacx

                          I'm not overthinking the problem, I just felt like I needed a small, unimportant, uninteresting rant! - Martin Hart Turner

                          0 I 2 Replies Last reply
                          0
                          • M Marc Clifton

                            Use XML. That should solve the problem. ;) Marc

                            Will work for food. Interacx

                            I'm not overthinking the problem, I just felt like I needed a small, unimportant, uninteresting rant! - Martin Hart Turner

                            0 Offline
                            0 Offline
                            0x3c0
                            wrote on last edited by
                            #14

                            No no no no no. That's insecure. Use a Caesar shift to make it unbreakable! :laugh:

                            OSDev

                            1 Reply Last reply
                            0
                            • M Marc Clifton

                              Use XML. That should solve the problem. ;) Marc

                              Will work for food. Interacx

                              I'm not overthinking the problem, I just felt like I needed a small, unimportant, uninteresting rant! - Martin Hart Turner

                              I Offline
                              I Offline
                              Iain Clarke Warrior Programmer
                              wrote on last edited by
                              #15

                              Not liquid nitrogen? I hear that's useful... Iain.

                              I have now moved to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[^]

                              1 Reply Last reply
                              0
                              • C Chamu Matumbura

                                Hie guys. I want to know if it is possible to declare variables at runtime in VB. Here is the logic trying to be achieved: Say you have a variable that you want to create out of a value in a table and then use it later in code, is it possible? Example: Table containing names: Animal Height Weight Color ------ ------ ------ ----- Dog 40 30 Brown Cat 20 3 Black ....... Then in your code you want to create a variable out of an animal name. To do this you will have a recordset or dataset with the animal atributes as shown above. The objective is to end up having variable names based on the Animal field, accommodating for new animals to be added, at runtime. From the above rows, the runtime code should create variables strDog and strCat. If any other animal, say XX, is added the same code should be able to create a variable strXX. Is this possible? Help please.

                                Reuse! Buy If You Can! Build If You Must

                                T Offline
                                T Offline
                                TheGreatAndPowerfulOz
                                wrote on last edited by
                                #16

                                The dog will eat the cat and the cow will jump over the moon

                                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