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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Form load

Form load

Scheduled Pinned Locked Moved Visual Basic
question
8 Posts 5 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.
  • P Offline
    P Offline
    pjackson18
    wrote on last edited by
    #1

    I'm calling a form with the show method, i would like to pass in a value from the calling form to the called form, to be used in form_load event. How can I do this?

    PJ

    E D M 3 Replies Last reply
    0
    • P pjackson18

      I'm calling a form with the show method, i would like to pass in a value from the calling form to the called form, to be used in form_load event. How can I do this?

      PJ

      E Offline
      E Offline
      Edbert P
      wrote on last edited by
      #2

      First you need to create the form before calling the Show() method. Then you can pass the values either by creating parameters in the called form, or creating a function that receives parameter in the called form. Another way is to create a new constructor of the form that accepts parameters.

      "A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin Edbert Sydney, Australia

      P 1 Reply Last reply
      0
      • P pjackson18

        I'm calling a form with the show method, i would like to pass in a value from the calling form to the called form, to be used in form_load event. How can I do this?

        PJ

        D Offline
        D Offline
        DontTouchMe
        wrote on last edited by
        #3

        In the called form, you declaire a public shared variable like: Public Shared myVar In the calling form you will: Dim mf as New CalledForm mf.myVar = ..... mf.ShowDialog() mf.Dispose() Is this your need?

        P C 2 Replies Last reply
        0
        • D DontTouchMe

          In the called form, you declaire a public shared variable like: Public Shared myVar In the calling form you will: Dim mf as New CalledForm mf.myVar = ..... mf.ShowDialog() mf.Dispose() Is this your need?

          P Offline
          P Offline
          pjackson18
          wrote on last edited by
          #4

          Thanks for you help!

          PJ

          1 Reply Last reply
          0
          • E Edbert P

            First you need to create the form before calling the Show() method. Then you can pass the values either by creating parameters in the called form, or creating a function that receives parameter in the called form. Another way is to create a new constructor of the form that accepts parameters.

            "A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin Edbert Sydney, Australia

            P Offline
            P Offline
            pjackson18
            wrote on last edited by
            #5

            Thanks for you help! It's a bit wet here in Sydney

            PJ

            C 1 Reply Last reply
            0
            • P pjackson18

              Thanks for you help! It's a bit wet here in Sydney

              PJ

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

              It's hailing in Hobart...

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              1 Reply Last reply
              0
              • D DontTouchMe

                In the called form, you declaire a public shared variable like: Public Shared myVar In the calling form you will: Dim mf as New CalledForm mf.myVar = ..... mf.ShowDialog() mf.Dispose() Is this your need?

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

                That's wrong. There is no need for the variable to be static ( shared ). Also, it's much nicer to pass it through a constructor, although a public variable will work.

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                1 Reply Last reply
                0
                • P pjackson18

                  I'm calling a form with the show method, i would like to pass in a value from the calling form to the called form, to be used in form_load event. How can I do this?

                  PJ

                  M Offline
                  M Offline
                  msleem
                  wrote on last edited by
                  #8

                  if you want to run a EXE (Name : WW) from an other EXE (Name : QQ) with value sent to it you can use sell "ww.exe value",vbnormalfocus it is good and semble

                  soly

                  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