DannyT Posted September 28, 2006 Posted September 28, 2006 (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 September 28, 2006 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted September 28, 2006 Administrators Posted September 28, 2006 HAve you tried using AddHandler to wire up the event handler instead of the HAndles keyword? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
DannyT Posted September 29, 2006 Author Posted September 29, 2006 aha! Thanks plausibly, I'd bodged it by manually bubbling the event, but I think addhandler will be a cleaner approach. I'm working on a .net implementation of the ARP Flash Platform framework. So far its going well... Thanks again! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.