Hi mate. Thanks for your time tonight.
Ok so i have copied your code into the form.
It may just be a typo but is Dim authenticated not supposed to be Dim isauthenticated
Code:
Dim authenticated As Boolean = AuthenticateUser()
If isAuthenticated Then
Other small issues that vb.net is throwing up are
txtUserNames is not declared
txtPasswords is not declared
on line
Dim domain As String = 'this can be in a config file, hard coded (I wouldnt do that), or inputed from the UI
it is moaning about the = saying expression expected.
Also it is moaning about Name 'ValidateActiveDirectoryLogin' is not declared.
Code:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim authenticated As Boolean = AuthenticateUser()
If isAuthenticated Then
'some code here to open app
Me.Close()
Else
'code here to display incorrect login details
End If
End Sub
Private Function AuthenticateUser() As Boolean
Dim username As String = txtUsername.Text
Dim password As String = txtPassword.Text
Dim domain As String = 'this can be in a config file, hard coded (I wouldnt do that), or inputed from the UI
Dim isAuthenticated As Boolean = ValidateActiveDirectoryLogin(username, password, domain)
Return isAuthenticated
End Function