Framework
A framework comprises of all different elements that make the production of a software system smoother and less complicated.

CPU Login Form

CPU Login Form is a login dialog box that sets the connection to a passed in server, database, user name and password.

Public Class CPULoginForm
Dim bSuccess As Boolean = false

Public Event LoginSuccess(Server As string, Database As string, UserName As string, Password As string)

Public Sub SetLoginInfo(Server As string, Database As string, UserName As string, Password As string)

txtServer.Text = Server
txtDatabase.Text = Database
txtUserName.Text = UserName
txtPassword.Text = Password

End Sub

Public Function ShowForm() As Boolean
Me.ShowDialog()
Return bSuccess
End Function


Private Sub btnOK_Click(sEnder As Object, e As EventArgs) Handles btnOK.Click
Me.DoLogin()

End Sub

Private Sub btnCancel_Click(sEnder As Object, e As EventArgs) Handles btnCancel.Click
bSuccess = false
Me.Close()
End Sub

Private Sub DoLogin()
Try
mdUtility.Login(txtServer.Text, txtDatabase.Text, txtUserName.Text, txtPassword.Text)
bSuccess = true
RaiseEvent LoginSuccess(txtServer.Text, txtDatabase.Text, txtUserName.Text, txtPassword.Text)
Me.Close()
Catch ex As Exception
bSuccess = false
Throw New CPUException("Login Failed. " & vbCrLf & ex.Message)
End Try
End Sub

End Class