Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. Imports System.Data.OleDb
  2. Public Class User_Record
  3.  
  4. Dim myconn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Visual Basic source\Assignment 2\Assignment 2\VBN.mdb")
  5. Dim cmdBuilder As OleDbCommandBuilder
  6. Dim ds As New DataSet
  7. Dim changes As DataSet
  8. Dim adaptor As New OleDbDataAdapter
  9.  
  10. Private Sub Closebtn_Click(sender As Object, e As EventArgs) Handles btnClose.Click
  11. Dim Ans As DialogResult = MessageBox.Show(" Are you sure you want to quit", "Are you sure?", MessageBoxButtons.YesNo)
  12. If Ans = DialogResult.Yes Then
  13. Me.Close()
  14. Administrator.Show()
  15. Else Me.Show()
  16. End If
  17. End Sub
  18.  
  19. Private Sub PatientBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
  20. Me.Validate()
  21. Me.UserBindingSource.EndEdit()
  22. Me.TableAdapterManager.UpdateAll(Me.VBNDataSet)
  23.  
  24. End Sub
  25.  
  26. Private Sub Patients_Record_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  27. 'TODO: This line of code loads data into the 'VBNDataSet.User' table. You can move, or remove it, as needed.
  28. Me.UserTableAdapter.Fill(Me.VBNDataSet.User)
  29.  
  30. With UserDataGridView
  31. .ClearSelection()
  32. .ReadOnly = True
  33. .MultiSelect = False
  34. End With
  35.  
  36. End Sub
  37.  
  38.  
  39. Private Sub Searchbtn_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
  40.  
  41. If txtKeyword.Text = "" Then
  42. MsgBox("Please key in your I/C or Passport Number.")
  43. Else
  44. Dim cantfine As String = txtKeyword.Text
  45. UserBindingSource.Filter = "(Convert([Username],'System.String') like '" & txtKeyword.Text & "')"
  46.  
  47. If UserBindingSource.Count <> 0 Then
  48. With UserDataGridView
  49. .DataSource = UserBindingSource
  50. End With
  51. Else
  52. MsgBox("Invalid Number")
  53.  
  54. UserBindingSource.Filter = Nothing
  55. With UserDataGridView
  56. .ClearSelection()
  57. .ReadOnly = True
  58. .MultiSelect = False
  59. .DataSource = UserBindingSource
  60.  
  61. End With
  62. End If
  63. End If
  64. End Sub
  65.  
  66. Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
  67. If MessageBox.Show("Are You Sure Want to DELETE this User account?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
  68. UserBindingSource.RemoveCurrent()
  69. Else
  70. txtKeyword.Clear()
  71. Me.Show()
  72. End If
  73. End Sub
  74.  
  75. Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
  76.  
  77.  
  78.  
  79.  
  80. End Sub
  81. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement