Results 1 to 2 of 2

Thread: MDI project loses object?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184

    Question MDI project loses object?

    Please help?

    I have an MDI project and I set the Startup Object to the name of the Parent form. The MDI application works fine except this bit now.....

    I create an object that creates and holds user info (I've a User Class) and want to use this throught the project so that I have the user details in an Object.

    The form starts up and creates children etc perfectly, but my UserObj is set to nothing, although it does initialise and fills its attributes/properties etc.

    Why does this dissapear?


    Some code might help?

    Code:
    ' This is the MDI Parent form.
    Public Class frmBOSSmain
    
        Inherits System.Windows.Forms.Form
    
        Public thisUser As BOSSuser
        ' Is this the correct place to declare this Object to use it throughout the MDI Project?
    
        Public Sub New()
            MyBase.New()
    
            'This call is required by the Windows Form Designer.
            InitializeComponent()
    
            'Add any initialization after the InitializeComponent() call
    
            ' Set up this User Object for the Project,
            thisUser = New BOSSuser
            ' Is this the correct place to Create this Object to use it throughout the MDI Project?
    
        End Sub
    
     Private Sub mnuTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuTest.Click
    
            MsgBox("User ID is: " & thisUser.UserName & " on Domain: " & thisUser.DomainName)
    
    ' The above message now has Nothing Object, where has it gone?
    ' Properties etc in the BOSSuser Class are fine and it initialises everything, but it seems to go out of scope?
    
    
        End Sub
    
    End Class

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184

    *** Resolved ***

    Managed to fix this. Fool that I am I was not using the Properties correctly to set the attributes.

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