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. One Class two forms

One Class two forms

Scheduled Pinned Locked Moved Visual Basic
question
2 Posts 2 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.
  • R Offline
    R Offline
    Rotti
    wrote on last edited by
    #1

    I would like to create an instance of a Class on Form1 and be able to use that same instance on a second form. I want to avoid using global/public variables and collections in a module. Can this be done? :confused: -Joe

    O 1 Reply Last reply
    0
    • R Rotti

      I would like to create an instance of a Class on Form1 and be able to use that same instance on a second form. I want to avoid using global/public variables and collections in a module. Can this be done? :confused: -Joe

      O Offline
      O Offline
      Oyvind Bratland
      wrote on last edited by
      #2

      I guess you could create a get-property i Form1 that returns the instance of Class1: public property get TheProperty as Class1 set TheProperty = myInstance end property So from Form2 do this to get the Class1 instance from Form1: set obj=Form1.TheProperty Hope this helps... Øyvind.

      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