Advertisement
sciexie

windows.form

Mar 14th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. Imports System.Windows.Forms
  2. Imports System.Data.Odbc
  3. Imports System.Data.DataTable
  4. Imports System.Data.DataSet
  5.  
  6.  
  7. Public Class windows
  8.  
  9. Dim myCmd As New OdbcCommand
  10. Dim connect As OdbcConnection
  11. Dim usrname As String
  12.  
  13.  
  14.  
  15. Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  16.  
  17. Me.Close()
  18.  
  19. End Sub
  20.  
  21. Private Sub changePass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles changePass.Click
  22.  
  23. On Error GoTo HandleErrors
  24.  
  25.  
  26. connectMe()
  27.  
  28. If txtnew_pass.Text & txtconfirmPass.Text = "" Then
  29. MessageBox.Show("Please fill up the form", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning)
  30.  
  31. Else
  32.  
  33.  
  34.  
  35. Dim Password As String
  36. Dim confirmedpwd As String
  37. Password = txtnew_pass.Text.Trim
  38. confirmedpwd = txtconfirmPass.Text.Trim
  39. If Password <> confirmedpwd Then
  40. MessageBox.Show("your password is not matched")
  41. Else
  42. connectMe()
  43. With myCmd
  44. .Connection = Con
  45. .CommandText = " update users set Password = '" & Password & "' where username = '" & usrname & "'"
  46. .ExecuteNonQuery()
  47. txtnew_pass.Enabled = True
  48. txtconfirmPass.Enabled = True
  49. txtnew_pass.Focus()
  50. End With
  51. txtnew_pass.Enabled = False
  52. txtconfirmPass.Enabled = True
  53. txtnew_pass.Focus()
  54. MessageBox.Show(" Password has been change")
  55. txtnew_pass.Clear()
  56. txtconfirmPass.Clear()
  57. txtnew_pass.Focus()
  58. Refresh()
  59.  
  60. End If
  61. End If
  62.  
  63.  
  64.  
  65. HandleErrors:
  66. 'MsgBox(Err.Number)
  67.  
  68. If Err.Number = 5 Then
  69.  
  70. MsgBox("Error: duplicate password" & Err.Number)
  71.  
  72.  
  73.  
  74. End If
  75.  
  76. End Sub
  77.  
  78.  
  79.  
  80.  
  81.  
  82. Public Property userName() As String
  83. Get
  84. Return usrname
  85.  
  86. End Get
  87. Set(ByVal value As String)
  88. usrname = value
  89. End Set
  90. End Property
  91.  
  92.  
  93.  
  94. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement