+ Reply to Thread
Results 1 to 5 of 5

How does Userform get initialized by this?

  1. #1
    RB Smissaert
    Guest

    How does Userform get initialized by this?

    Trying to figure out how a Userform gets initialized.
    Found that this line of code in a normal module:

    strINIPath = strLocalDrive & ":\Test.ini"

    Initializes this Userform.

    strINIPath and strLocalDrive are Public variables, declared in a normal
    module and these
    variables are not used in this Userform.


    I test like this:

    Set MainForm = Nothing

    On Error Resume Next
    Msgbox MainForm Is Nothing

    strINIPath = strLocalDrive & ":\Test.ini"

    Msgbox MainForm Is Nothing

    The second messagebox will give False.


    Thanks for any insight in this.


    RBS





  2. #2
    Tom Ogilvy
    Guest

    Re: How does Userform get initialized by this?

    If I had a userform named MainForm, then I received false for both message
    boxes.

    referencing a useform loads the userform.

    To check if it is loaded, you have to loop through the userforms collection,
    not check if it is nothing.

    --
    Regards,
    Tom Ogilvy


    "RB Smissaert" <[email protected]> wrote in message
    news:[email protected]...
    > Trying to figure out how a Userform gets initialized.
    > Found that this line of code in a normal module:
    >
    > strINIPath = strLocalDrive & ":\Test.ini"
    >
    > Initializes this Userform.
    >
    > strINIPath and strLocalDrive are Public variables, declared in a normal
    > module and these
    > variables are not used in this Userform.
    >
    >
    > I test like this:
    >
    > Set MainForm = Nothing
    >
    > On Error Resume Next
    > Msgbox MainForm Is Nothing
    >
    > strINIPath = strLocalDrive & ":\Test.ini"
    >
    > Msgbox MainForm Is Nothing
    >
    > The second messagebox will give False.
    >
    >
    > Thanks for any insight in this.
    >
    >
    > RBS
    >
    >
    >
    >




  3. #3
    RB Smissaert
    Guest

    Re: How does Userform get initialized by this?

    Just wondering why Mainform is not Nothing anymore after that line of code.
    Maybe it is academic as I have no particular problem to solve, but just
    trying to understand how this works.

    RBS

    "Tom Ogilvy" <[email protected]> wrote in message
    news:%[email protected]...
    > If I had a userform named MainForm, then I received false for both message
    > boxes.
    >
    > referencing a useform loads the userform.
    >
    > To check if it is loaded, you have to loop through the userforms
    > collection,
    > not check if it is nothing.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "RB Smissaert" <[email protected]> wrote in message
    > news:[email protected]...
    >> Trying to figure out how a Userform gets initialized.
    >> Found that this line of code in a normal module:
    >>
    >> strINIPath = strLocalDrive & ":\Test.ini"
    >>
    >> Initializes this Userform.
    >>
    >> strINIPath and strLocalDrive are Public variables, declared in a normal
    >> module and these
    >> variables are not used in this Userform.
    >>
    >>
    >> I test like this:
    >>
    >> Set MainForm = Nothing
    >>
    >> On Error Resume Next
    >> Msgbox MainForm Is Nothing
    >>
    >> strINIPath = strLocalDrive & ":\Test.ini"
    >>
    >> Msgbox MainForm Is Nothing
    >>
    >> The second messagebox will give False.
    >>
    >>
    >> Thanks for any insight in this.
    >>
    >>
    >> RBS
    >>
    >>
    >>
    >>

    >
    >



  4. #4
    Tom Ogilvy
    Guest

    Re: How does Userform get initialized by this?

    for me it was not nothing before that line of code.

    --
    Regards,
    Tom Ogilvy

    "RB Smissaert" <[email protected]> wrote in message
    news:%[email protected]...
    > Just wondering why Mainform is not Nothing anymore after that line of

    code.
    > Maybe it is academic as I have no particular problem to solve, but just
    > trying to understand how this works.
    >
    > RBS
    >
    > "Tom Ogilvy" <[email protected]> wrote in message
    > news:%[email protected]...
    > > If I had a userform named MainForm, then I received false for both

    message
    > > boxes.
    > >
    > > referencing a useform loads the userform.
    > >
    > > To check if it is loaded, you have to loop through the userforms
    > > collection,
    > > not check if it is nothing.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "RB Smissaert" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> Trying to figure out how a Userform gets initialized.
    > >> Found that this line of code in a normal module:
    > >>
    > >> strINIPath = strLocalDrive & ":\Test.ini"
    > >>
    > >> Initializes this Userform.
    > >>
    > >> strINIPath and strLocalDrive are Public variables, declared in a normal
    > >> module and these
    > >> variables are not used in this Userform.
    > >>
    > >>
    > >> I test like this:
    > >>
    > >> Set MainForm = Nothing
    > >>
    > >> On Error Resume Next
    > >> Msgbox MainForm Is Nothing
    > >>
    > >> strINIPath = strLocalDrive & ":\Test.ini"
    > >>
    > >> Msgbox MainForm Is Nothing
    > >>
    > >> The second messagebox will give False.
    > >>
    > >>
    > >> Thanks for any insight in this.
    > >>
    > >>
    > >> RBS
    > >>
    > >>
    > >>
    > >>

    > >
    > >

    >




  5. #5
    RB Smissaert
    Guest

    Re: How does Userform get initialized by this?

    Did you do: Set MainForm = Nothing ?

    RBS

    "Tom Ogilvy" <[email protected]> wrote in message
    news:%[email protected]...
    > for me it was not nothing before that line of code.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "RB Smissaert" <[email protected]> wrote in message
    > news:%[email protected]...
    >> Just wondering why Mainform is not Nothing anymore after that line of

    > code.
    >> Maybe it is academic as I have no particular problem to solve, but just
    >> trying to understand how this works.
    >>
    >> RBS
    >>
    >> "Tom Ogilvy" <[email protected]> wrote in message
    >> news:%[email protected]...
    >> > If I had a userform named MainForm, then I received false for both

    > message
    >> > boxes.
    >> >
    >> > referencing a useform loads the userform.
    >> >
    >> > To check if it is loaded, you have to loop through the userforms
    >> > collection,
    >> > not check if it is nothing.
    >> >
    >> > --
    >> > Regards,
    >> > Tom Ogilvy
    >> >
    >> >
    >> > "RB Smissaert" <[email protected]> wrote in message
    >> > news:[email protected]...
    >> >> Trying to figure out how a Userform gets initialized.
    >> >> Found that this line of code in a normal module:
    >> >>
    >> >> strINIPath = strLocalDrive & ":\Test.ini"
    >> >>
    >> >> Initializes this Userform.
    >> >>
    >> >> strINIPath and strLocalDrive are Public variables, declared in a
    >> >> normal
    >> >> module and these
    >> >> variables are not used in this Userform.
    >> >>
    >> >>
    >> >> I test like this:
    >> >>
    >> >> Set MainForm = Nothing
    >> >>
    >> >> On Error Resume Next
    >> >> Msgbox MainForm Is Nothing
    >> >>
    >> >> strINIPath = strLocalDrive & ":\Test.ini"
    >> >>
    >> >> Msgbox MainForm Is Nothing
    >> >>
    >> >> The second messagebox will give False.
    >> >>
    >> >>
    >> >> Thanks for any insight in this.
    >> >>
    >> >>
    >> >> RBS
    >> >>
    >> >>
    >> >>
    >> >>
    >> >
    >> >

    >>

    >
    >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1