任何人都知道解决方案吗?

时间:2016-09-26 14:09:10

标签: vb.net vb.net-2010

 Private Sub Btnlog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnlog.Click
        If txtuser.Text = "Manish" And txtpw.Text = "Nair" Then
            MessageBox.Show("welcome")
        Else

            MessageBox.Show("Try again")
            count= count() + 1
            If count = 3 Then
                Me.Close()
            End If



        End If
    End Sub

1 个答案:

答案 0 :(得分:1)

你还没有说明这个问题。但是,只需阅读您的代码,您就可以使用count()来调用变量count作为函数。此外,永远不会定义计数。请尝试:

     Private Sub Btnlog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnlog.Click
            dim count as integer = 0 ' Define count

            If txtuser.Text = "Manish" And txtpw.Text = "Nair" Then
                MessageBox.Show("welcome")
            Else
                MessageBox.Show("Try again")
                count = count + 1

                If count = 3 Then
                    Me.Close()
                End If
            End If
        End Sub