Results 1 to 7 of 7

Thread: Startup Object in Code

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617
    Hi!

    Does any 1 know how I can reference the startup form
    in a project via code...

    (If you go into your project's properties, click on the
    General tab, and StartUp Object...)

    Thanks in advance..

  2. #2
    Junior Member
    Join Date
    Nov 2000
    Posts
    30

    Lightbulb startup form

    im not sure that this will work, but a simple way would be to set it as a variable first. Im not sure if this is what you are asking, but you could just define a global variable frmStartUpForm as Form.

    and just put frmStartUpForm = form1.(form?)
    i dont knoe if you need the form at the ened but hey you might. ive never had the need to do this but that will probably work

    and then when you want to activate it just do frmStartUpForm.show. or load frmStartUpForm i think may work also, but you may have to tweak the code some to get it to work.
    --> noware <--
    john@wet-online.com

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ..

    I am not supposed to know what it is

    I am supposed to look into that area and find out what is there and use it...

    Thanks in advance

  4. #4
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    400
    I'm assuming that at the point where the program needs to know this, the project file will exist on disk. If it's just the exe, you should have known the startup object when you made the exe.

    Open the *.vbp file for input, and read in 1 line at a time. Look for:

    Startup="Sub Main"

    and take everything after the =, then strip the quotes.


  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    !!!!

    jmc.....Thanks...

    Now, If I can take that string and turn into an object
    so that I can do, say, (mine being a form)

    frmOne.something

    I'd be all set

  6. #6
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    400
    You can, but only if the form is loaded:

    Code:
        Dim strForm As String
        Dim frm As Form
        
        strForm = "frmMain"
        For Each frm In Forms
            If frm.Name = strForm Then Exit For
        Next
        Debug.Print frm.Caption
        Set frm = Nothing

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ...

    Very gut.... my friend

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width