Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I have an MDI form i'm using as an Application class

 

This application "has a" login form as a private property which is exposed to a consuming application controller class via a public getter.

 

I want my controller to handle a login event raised by the login form, however I cannot seem to handle events of the login form as a property of the application?

 

E.g. (pseudo code)

Public Class Application
   private controller as Controller
   private login as LoginForm

   Public ReadOnly Property UserLoginForm() As LoginForm
       Get
           Return Me.login
       End Get
   End Property

   Private Sub Application_Load() Handles MyBase.Load
       Me.controller = controller.GetInstance
       Me.controller.RegisterApp(Me)
       RaiseEvent AppLaunched()
   End Sub

End Class

Public Class Controller
   Private Property withevents viewRef as Application

   Public Sub new(app as Application)
       me.viewRef = app
   End Sub

   Public Sub GetInstance() As Controller
       'singleton code
   End Sub

   '**********THE PROBLEM CODE***********
   Public Sub UserLogin() Handles viewRef.UserLoginForm.loginEvent  'can't access UserLoginForm's events???
       'do something with a command
   End Sub

End Class

The problem is my UserLogin function on the controller can't seem to access the Applications UserLoginForm property to handle it's events.

 

Hope that makes some sort of sense and someone can help?

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...