This is my code :
Everything is running fine but I want if youssef function is ok then calculator form shows and if Mariam function is done then calculator form shows,idk know what's wrong with this part?
HTML Code:
Public Class login
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim usernam1 As String = "youssef"
Dim usernam2 As String = "Mariam"
Dim unknown As String = TextBox.Text
Dim password1 As String = "hey"
Dim password2 As String = "hi"
Dim unknownp As String = TextBox2.Text
If TextBox.Text = usernam1 Then
Label3.Text = "Correct"
ElseIf TextBox.Text = usernam2 Then
Label3.Text = "Correct"
ElseIf TextBox.Text = unknown Then
Label3.Text = "Invaild username"
End If
If TextBox2.Text = password1 Then
Label4.Text = "Correct"
ElseIf TextBox2.Text = password2 Then
Label4.Text = "Correct"
ElseIf TextBox2.Text = unknownp Then
Label4.Text = "Invalid Password"
End If
If youssef() Then
Calculator.Show()
ElseIf Mariam() Then
Calculator.Show()
End If
End Sub
Private Function youssef() As Boolean
If Label3.Text = "Correct" And Label4.Text = "Correct" And TextBox.Text = "youssef" And TextBox2.Text = "hey" Then
MessageBox.Show("Welcome Youssef", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Function
Private Function Mariam() As Boolean
If Label3.Text = "Correct" And Label4.Text = "Correct" And TextBox.Text = "Mariam" And TextBox2.Text = "hi" Then
MessageBox.Show("Welcome Mariam", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Function
End Class
HTML Code:
If youssef() Then
Calculator.Show()
ElseIf Mariam() Then
Calculator.Show()
End If