2016-09-26 102 views
-1
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

您还没有说明问题。但是,只要读取你的代码,就可以使用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 
相关问题