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. take variable value from other form

take variable value from other form

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
5 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.
  • S Offline
    S Offline
    shee_dee86
    wrote on last edited by
    #1

    hi, im using VS2008 and working on windows form application, i have a problem, is it can i take variable value from other form to another one form, or variable value from same form but different event. for example: pivate sub button1_click(byval........ dim one as string one = "Hello" end sub then, i want take the value from variable 'one' and use it on another button click event for example: private sub button2_click(byval.... 'here is the problem about how can i take 'the value in variable 'one' at button1_click event to be use in 'this event end sub

    D S V C 4 Replies Last reply
    0
    • S shee_dee86

      hi, im using VS2008 and working on windows form application, i have a problem, is it can i take variable value from other form to another one form, or variable value from same form but different event. for example: pivate sub button1_click(byval........ dim one as string one = "Hello" end sub then, i want take the value from variable 'one' and use it on another button click event for example: private sub button2_click(byval.... 'here is the problem about how can i take 'the value in variable 'one' at button1_click event to be use in 'this event end sub

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

      Variable Scope[^]

      1 Reply Last reply
      0
      • S shee_dee86

        hi, im using VS2008 and working on windows form application, i have a problem, is it can i take variable value from other form to another one form, or variable value from same form but different event. for example: pivate sub button1_click(byval........ dim one as string one = "Hello" end sub then, i want take the value from variable 'one' and use it on another button click event for example: private sub button2_click(byval.... 'here is the problem about how can i take 'the value in variable 'one' at button1_click event to be use in 'this event end sub

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

        try this..................... dim one as string pivate sub button1_click(byval........ one = "Hello" end sub then, if i want take the value from variable 'one' and use it on another button click event for example: private sub button2_click(byval.... msgbox (one) end sub

        1 Reply Last reply
        0
        • S shee_dee86

          hi, im using VS2008 and working on windows form application, i have a problem, is it can i take variable value from other form to another one form, or variable value from same form but different event. for example: pivate sub button1_click(byval........ dim one as string one = "Hello" end sub then, i want take the value from variable 'one' and use it on another button click event for example: private sub button2_click(byval.... 'here is the problem about how can i take 'the value in variable 'one' at button1_click event to be use in 'this event end sub

          V Offline
          V Offline
          V 2
          wrote on last edited by
          #4

          If i understood your post right then First declare the the variable globaly and public on form first not in any procedure Public one as string then on second form dim frm as form1 msgbox(frm.one.tostring) ' u can use it any event of form2 Hope it will help u

          Unless u don't give ur hundred percent whatever u r doning till there is no result of ur work...

          1 Reply Last reply
          0
          • S shee_dee86

            hi, im using VS2008 and working on windows form application, i have a problem, is it can i take variable value from other form to another one form, or variable value from same form but different event. for example: pivate sub button1_click(byval........ dim one as string one = "Hello" end sub then, i want take the value from variable 'one' and use it on another button click event for example: private sub button2_click(byval.... 'here is the problem about how can i take 'the value in variable 'one' at button1_click event to be use in 'this event end sub

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

            The best way to do this is to create a delegate that passes the value between forms. Or use a property ( NOT just a variable ) that allows you to get ( but not set ) the value if the second form is a child of the first. As for within the one form, place the variable at application scope. And, if you don't know that, you really need to buy a beginner book instead of relying on online help only.

            Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

            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