Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27333

If mistake !

$
0
0
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 showd() Then
            Me.Close()
        End If




    End Sub
    Private Function showd() As Boolean

        If youssef() Or Mariam() Then
            If MessageBox.Show("Do you want to continue?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
                Calculator.Show()

            End If

        End If
        Return True


    End Function
    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
        Return True

    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
        Return True


    End Function
End Class

I don't know what the **** is wrong with this part?
HTML Code:

Private Function showd() As Boolean

        If youssef() Or Mariam() Then
            If MessageBox.Show("Do you want to continue?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
                Calculator.Show()

            End If

        End If
        Return True


    End Function


I want if function youssef or function Mariam then calculator form shows and if it's not youssef or mariam it just end the programme

Viewing all articles
Browse latest Browse all 27333

Trending Articles