Advertisement
Guest User

login

a guest
Jun 12th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class LogIn
  2.  
  3.     Private SQL As New SQLControl
  4.  
  5.     Private Sub LogIn_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  6.         Me.KeyPreview = True
  7.  
  8.         If SQL.hasConnection = True Then
  9.             ToolStripStatusLabel1.Text = "Kontektovan."
  10.         Else
  11.             Me.Close()
  12.         End If
  13.  
  14.     End Sub
  15.  
  16.     Private Function logincheck() As Boolean
  17.         If SQL.SQLDS IsNot Nothing Then
  18.             SQL.SQLDS.Clear()
  19.         End If
  20.  
  21.         SQL.runQuery("select count(username) as userCount from administrator where username='" &
  22.                      userText.Text & "' and password='" & passText.Text & "' collate SQL_Latin1_General_CP1_CS_AS")
  23.         If SQL.SQLDS.Tables(0).Rows(0).Item("userCount") = 1 Then
  24.             Return True
  25.         End If
  26.         MsgBox("Neispravni podaci", MsgBoxStyle.Critical, "Neuspješno logovanje")
  27.         Return False
  28.     End Function
  29.  
  30.     Private Sub loginBtn_Click(sender As Object, e As EventArgs) Handles loginBtn.Click
  31.         If logincheck() = True Then
  32.             Main.Show()
  33.             Me.Hide()
  34.         End If
  35.     End Sub
  36.  
  37.     Private Sub loginBtn_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
  38.         If e.KeyChar = "Enter" Then
  39.             MsgBox("B key was pressed")
  40.         End If
  41.     End Sub
  42. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement