Error while adding a handler in VB.Net

liunx

Guest
Hi,
I am converting a C# application to VB.Net and while trying to change the following line i got an error stating "Object reference not set to an instance of an object". I guess i am not able to add a handler correctly. Please help.
C# - Start
'Me.OsaLogin1.Authenticate += new Osa.UI.Controls.OSAAuthenticateEventHandler(me.OsaLogin1_Authenticate);
'Me.Load += new System.EventHandler(me.Page_Load);
C# End
-VB.Net Start
AddHandler OsaLogin1.Authenticate, AddressOf Me.OsaLogin1_Authenticate
AddHandler Load, AddressOf Me.Page_Load
VB.Net End

Private Sub OsaLogin1_Authenticate(ByVal sender As Object, ByVal e As Osa.UI.Controls.AuthenticateEventArgs)
System.Diagnostics.Trace.Write("private void OsaLogin1_Authenticate(object sender, Osa.UI.Controls.AuthenticateEventArgs e)")
Dim _credentials As OsaCredentials = New OsaCredentials(e.User, e.Password)
If OsaAccountManager.GetManager.AccountingService.Validate(_credentials) Then
System.Diagnostics.Trace.Write("User is validated")
e.AuthenticationResult = Osa.UI.Controls.AuthenticateResultEnum.success
e.CreateTicket = True
CType(OsaAccountManager.GetManager.AccountingService, OsaMobHigherAuthVBDotNet.CustomAccountingService).CurrentAccount = CType(OsaAccountManager.GetManager.AccountingService.GetAccount(e.User), CustomAccount)
Else
System.Diagnostics.Trace.Write("Invalid User")
OsaLogin1.StatusMessage = ("Login failed for user - " + e.User.ToString)
e.AuthenticationResult = Osa.UI.Controls.AuthenticateResultEnum.fail
End If
End Sub
 
Back
Top