Forms access null exception.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LeoVBNET
    New Member
    • Apr 2013
    • 29

    Forms access null exception.

    Hi
    This is stranged:

    This first scenario works good!!!
    =============== =============== ====
    FORM1
    F3 AS NEW FORM3
    F3.SHOWDIALOG()

    FRIEND SUB METHOD()
    F3.BACKCOLOR = AQUA <----- (WORKS FINE)
    END SUB
    =============== =============== =====
    FORM3
    FORM1.METHOD()
    =============== =============== =====

    This second scenario DOES NOT work !!!
    =============== =============== =====
    FORM1
    F2 AS NEW FORM2
    F2.SHOWDIALOG()
    =============== =============== =====
    FORM2
    F3 AS NEW FORM3
    F3.SHOWDIALOG()

    FRIEND SUB METHOD()
    F3.BACKCOLOR = AQUA <----- F3 IS NOTHING !!!! (EXCEPTION)
    END SUB
    =============== =============== =====
    FORM3
    FORM2.METHOD()
    =============== =============== =====

    Sorry for this poor explanation but it is 2:25 AM and I'm exhausted.

    Thanks
  • ambusy
    New Member
    • Aug 2014
    • 5

    #2
    When you write FORM2.METHOD() in F3, you (implicitly) create a new instance of FORM2, which DIMs an new instance of F3, and calls it's method METHOD. This instance knows NOTHING of the existence of other instances. You perhaps wanted the method METHOD of F2 executed on it's F3. If so make F2 and F3 Friend and you have no more problems

    Comment

    Working...