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. new Form by name?

new Form by name?

Scheduled Pinned Locked Moved Visual Basic
question
5 Posts 3 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.
  • A Offline
    A Offline
    Andy Smith
    wrote on last edited by
    #1

    [VB6] Anybody know of a way to create a new instance of a form if you only know the name of the form? Right now i'm doing a huge hack... a big select case statement. there has to be a better way!?!?!

    N J 2 Replies Last reply
    0
    • A Andy Smith

      [VB6] Anybody know of a way to create a new instance of a form if you only know the name of the form? Right now i'm doing a huge hack... a big select case statement. there has to be a better way!?!?!

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      Could you give us a better idea of what you are doing exactly. There are ways to create new forms programmatically. Nick Parker

      A 1 Reply Last reply
      0
      • N Nick Parker

        Could you give us a better idea of what you are doing exactly. There are ways to create new forms programmatically. Nick Parker

        A Offline
        A Offline
        Andy Smith
        wrote on last edited by
        #3

        aight, here's the deal... on the left, I have a treeview that holds a bunch of nodes which represent forms to open. They hold the name of the form as a string as their key. when somebody clicks on a node, it should open a new instance of the form, by name. If there is a better overall way to do the same effect, that'd be fine as well. The basic gist of what I want is a list of the form's which can be shown, and to make a new one when the user clicks on it. It is possible to open more than one of the same form at a time.

        1 Reply Last reply
        0
        • A Andy Smith

          [VB6] Anybody know of a way to create a new instance of a form if you only know the name of the form? Right now i'm doing a huge hack... a big select case statement. there has to be a better way!?!?!

          J Offline
          J Offline
          James T Johnson
          wrote on last edited by
          #4

          Dim myForm as Form Set myForm = new Forms("MyFormName") I've seen something similar to that, but I don't have VB 6 installed so I can't check it. Should give you a start anyway, James Simplicity Rules!

          A 1 Reply Last reply
          0
          • J James T Johnson

            Dim myForm as Form Set myForm = new Forms("MyFormName") I've seen something similar to that, but I don't have VB 6 installed so I can't check it. Should give you a start anyway, James Simplicity Rules!

            A Offline
            A Offline
            Andy Smith
            wrote on last edited by
            #5

            hrm the Forms collection only shows forms which are already loaded. besides, I don't think I'd be able to create a _new instance_ with this method. also, the New Forms("MyFormName") syntax doesn't compile. I even tried a CallByName hack ( Set myForm = CallByName( App, "MyFormName", vbGet ) ), but that didn't work either. any other ideas?

            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