Advertisement
UsernameHere1

Untitled

Feb 21st, 2024
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 24.89 KB | None | 0 0
  1. Imports System.IO 'imports the input and output features
  2. Imports System.Reflection
  3. Imports System.Xml.Schema
  4.  
  5. Public Class CustomerData 'the customer data form
  6.     Dim lineCount As Integer 'The full amount of records in the file
  7.     Dim rowIndex As Integer 'The currently selected row of the datagrid
  8.     Private Sub bubbleSort(ByVal index As Integer)
  9.         Dim tempArray(8) As String 'temporay array for swaps
  10.         Dim record1(8) As String 'records being compared
  11.         Dim record2(8) As String
  12.         For passes = 0 To lineCount - 1
  13.             For counter = 0 To lineCount - 2 'to last but one row in data grid
  14.                 record1(0) = dgv_customerData.Rows(counter).Cells(0).Value 'set array values to records
  15.                 record1(1) = dgv_customerData.Rows(counter).Cells(1).Value
  16.                 record1(2) = dgv_customerData.Rows(counter).Cells(2).Value
  17.                 record1(3) = dgv_customerData.Rows(counter).Cells(3).Value
  18.                 record1(4) = dgv_customerData.Rows(counter).Cells(4).Value
  19.                 record1(5) = dgv_customerData.Rows(counter).Cells(5).Value
  20.                 record1(6) = dgv_customerData.Rows(counter).Cells(6).Value
  21.                 record1(7) = dgv_customerData.Rows(counter).Cells(7).Value
  22.                 record2(0) = dgv_customerData.Rows(counter + 1).Cells(0).Value
  23.                 record2(1) = dgv_customerData.Rows(counter + 1).Cells(1).Value
  24.                 record2(2) = dgv_customerData.Rows(counter + 1).Cells(2).Value
  25.                 record2(3) = dgv_customerData.Rows(counter + 1).Cells(3).Value
  26.                 record2(4) = dgv_customerData.Rows(counter + 1).Cells(4).Value
  27.                 record2(5) = dgv_customerData.Rows(counter + 1).Cells(5).Value
  28.                 record2(6) = dgv_customerData.Rows(counter + 1).Cells(6).Value
  29.                 record2(7) = dgv_customerData.Rows(counter + 1).Cells(7).Value
  30.                 If record1(index) > record2(index) Then 'swap (comparison based on the index of value)
  31.                     tempArray = record1
  32.                     record1 = record2
  33.                     record2 = tempArray
  34.                 End If
  35.                 dgv_customerData.Rows(counter).SetValues(record1) 'updates datagrid
  36.                 dgv_customerData.Rows(counter + 1).SetValues(record2)
  37.             Next
  38.         Next
  39.     End Sub
  40.     Private Sub fillGrid() 'fill the datagrid
  41.         Dim encryption As New clsEncryption 'instantiate the encryption class
  42.         lineCount = File.ReadAllLines("customerData.txt").Length 'make the linecount be the amount of records in the file
  43.         Dim startupPath As String 'stores the location the program is running
  44.         startupPath = Application.StartupPath
  45.         Dim record As String 'a record from the file
  46.         Dim fields() As String 'the fields in the record
  47.         dgv_customerData.Rows.Clear() 'empty the datagrid
  48.         Dim sr As New StreamReader("customerData.txt") 'Stream reader of the customer data file
  49.         While sr.Peek() >= 0 'while there are records to read
  50.             record = encryption.decrypt(sr.ReadLine) 'decrypt the record
  51.             fields = record.Split(",") 'split the record into fields
  52.             Dim index = dgv_customerData.Rows.Add 'the next row to add to
  53.             dgv_customerData.Rows(index).SetValues(fields) 'add a record to the datagrid by putting each field in its correct place
  54.         End While
  55.         sr.Close() 'close the stream reader
  56.         dgv_customerData.RowHeadersVisible = False 'Removes the symbols by the rows
  57.         dgv_customerData.ClearSelection() 'Removes the blue selection box
  58.         dgv_customerData.Rows(lineCount - 1).Selected = True 'select the final record in the datagrid
  59.         rowIndex = lineCount - 1 'show the currenty corrected row
  60.         txt_customerName.Text = "Customer Name" 'reset text boxes
  61.         txt_surname.Text = "Surname"
  62.         txt_DOB.Text = "Date of Birth"
  63.         txt_email.Text = "Email"
  64.         txt_phoneNumber.Text = "Phone Number"
  65.         txt_postcode.Text = "Postcode"
  66.         txt_accountID.Text = "AccountID"
  67.         txt_search.Text = "Search by CustomerID"
  68.         txt_CustomerID.Text = "CustomerID"
  69.     End Sub
  70.     Private Sub CustomerData_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'when form loads
  71.         Me.CenterToScreen() 'center form to screen
  72.         Dim encryption As New clsEncryption 'instanitate the encryption class
  73.         Dim startupPath As String = Application.StartupPath 'stores the location the program is running
  74.         pbx_logo.ImageLocation = startupPath & "\PennardLibraryLogo.png" 'set the image locations
  75.         pbx_back.ImageLocation = startupPath & "\Arrow.png"
  76.         If levelOfAccess = 2 Then
  77.             Me.BackColor = Color.FromArgb(140, 227, 245) 'for librarians use blue
  78.         End If
  79.         If levelOfAccess = 3 Then
  80.             Me.BackColor = Color.FromArgb(247, 220, 143) 'for admins use yellow
  81.         End If
  82.         If Dir(startupPath & "\customerData.txt") = "" Then 'if file doesnt exist
  83.             Dim sw As New StreamWriter("customerData.txt", True) 'stream writer to append the customer data file
  84.             sw.WriteLine(encryption.encrypt("1,Pam,Hopkins,10/09/1970,pam.hopkin@gmail.com,01792233277,SA3 2AQ,1")) 'records to be added
  85.             sw.WriteLine(encryption.encrypt("2,John,Jones,11/04/1996,johnjones@cantab.net,01792679061,SA3 3LF,2"))
  86.             sw.Close() 'close stream writer
  87.             MsgBox("customerData file has been created") 'notify user the file was made
  88.         End If
  89.         If Dir(startupPath & "\tempCustomerData") = "" Then 'if the temp file doesnt exist
  90.             Dim sw As New StreamWriter("tempCustomerData.txt", False) 'make it with a stream writer
  91.             sw.Close() 'close the stream writer
  92.         End If
  93.         fillGrid() 'fill the data grid
  94.     End Sub
  95.     Private Sub btn_viewAll_Click(sender As Object, e As EventArgs) Handles btn_viewAll.Click
  96.         fillGrid() 'fill the data grid
  97.     End Sub
  98.     Private Sub btn_add_Click(sender As Object, e As EventArgs) Handles btn_add.Click
  99.         Dim encryption As New clsEncryption 'instantiate the encryption class
  100.         Dim validation As New clsValidation 'instantiate the clsValidation class
  101.         Dim validated As Boolean = True 'is validation met
  102.         Dim record As String 'a record from the file
  103.         Dim fields() As String 'the fields in the record
  104.         Dim addCustomerID As Integer = 0 'the customer ID to add
  105.         Dim addCustomerName As String 'the customer data to add
  106.         Dim addSurname As String
  107.         Dim addDOB As String
  108.         Dim addEmail As String
  109.         Dim addPhoneNumber As String
  110.         Dim addPostcode As String
  111.         Dim addAccountID As String
  112.         Dim sr As New StreamReader("customerData.txt") 'Stream reader of the customer data file
  113.         While sr.Peek() >= 0 'while there are records to read
  114.             record = encryption.decrypt(sr.ReadLine) 'decrypt the record
  115.             fields = record.Split(",") 'split the record into fields
  116.             If fields(0) >= addCustomerID Then 'if the ID is higher than the ID being added
  117.                 addCustomerID = fields(0) + 1 'Makes sure the bookID being added is always 1 greater than the current largest stored
  118.             End If
  119.         End While
  120.         sr.Close() 'close the stream reader
  121.         If validation.characterCheck(txt_customerName.Text, ",") = False Or validation.characterCheck(txt_surname.Text, ",") = False Or validation.characterCheck(txt_DOB.Text, ",") = False Or validation.characterCheck(txt_email.Text, ",") = False Or validation.characterCheck(txt_phoneNumber.Text, ",") = False Or validation.characterCheck(txt_postcode.Text, ",") = False Or validation.characterCheck(txt_accountID.Text, ",") = False Then 'doesnt allow for commas to be entered
  122.             validated = False 'doesnt allow any field to have a comma in it (this is a long line of every field's validation for this)
  123.             MsgBox("Data cannot contain commas")
  124.         End If
  125.         If validation.presenceCheck(txt_customerName.Text) = True And txt_customerName.Text <> "Customer Name" Then 'presence check for all fields
  126.             addCustomerName = txt_customerName.Text 'set the value
  127.         Else
  128.             validated = False 'validation not met
  129.         End If
  130.         If validation.presenceCheck(txt_surname.Text) = True And txt_surname.Text <> "Surname" Then 'same as with customer name
  131.             addSurname = txt_surname.Text
  132.         Else
  133.             validated = False
  134.         End If
  135.         If validation.presenceCheck(txt_DOB.Text) = True And txt_surname.Text <> "Date of Birth" And validation.lengthCheck(txt_DOB.Text, 10, 10) Then
  136.             addDOB = txt_DOB.Text 'same as with customer name but makes sure the DOB is 10 characters
  137.         Else
  138.             validated = False
  139.         End If
  140.         If validation.presenceCheck(txt_email.Text) = True And txt_email.Text <> "Email" Then
  141.             addEmail = txt_email.Text
  142.         Else
  143.             validated = False
  144.         End If
  145.         If validation.presenceCheck(txt_phoneNumber.Text) = True And txt_phoneNumber.Text <> "Phone Number" And validation.lengthCheck(txt_phoneNumber.Text, 11, 11) Then
  146.             addPhoneNumber = txt_phoneNumber.Text 'same as DOB but with 11 characters
  147.         Else
  148.             validated = False
  149.         End If
  150.         If validation.presenceCheck(txt_postcode.Text) = True And txt_postcode.Text <> "Postcode" Then
  151.             addPostcode = txt_postcode.Text
  152.         Else
  153.             validated = False
  154.         End If
  155.         If validation.presenceCheck(txt_accountID.Text) = True And txt_accountID.Text <> "AccountID" Then
  156.             addAccountID = txt_accountID.Text
  157.         Else
  158.             validated = False
  159.         End If
  160.         If validated = True Then 'if all validation is met
  161.             Dim sw As New StreamWriter("customerData.txt", True) 'Stream writer of the customer data file to append
  162.             sw.WriteLine(encryption.encrypt(addCustomerID & "," & addCustomerName & "," & addSurname & "," & addDOB & "," & addEmail & "," & addPhoneNumber & "," & addPostcode & "," & addAccountID)) 'add a encrypted record to the file
  163.             sw.Close() 'close stream writer
  164.         Else
  165.             MsgBox("You need to fill out all fields and meet all validation requirements") 'notify user not all validation is met
  166.         End If
  167.         fillGrid() 'fill the datag grid
  168.     End Sub
  169.     Private Sub btn_search_Click(sender As Object, e As EventArgs) Handles btn_search.Click
  170.         Dim encryption As New clsEncryption 'instantiate the encryption class
  171.         Dim validation As New clsValidation 'instantiate the validation class
  172.         lineCount = File.ReadAllLines("customerData.txt").Length 'the amount of record in the file
  173.         Dim found As Boolean = False 'has the ID been found
  174.         Dim record As String 'a record from the file
  175.         Dim fields() As String 'the fields in the record
  176.         Dim recordCount As Integer = 0 'the amount of records in the file
  177.         Dim sr As New StreamReader("customerData.txt") 'a stream reader of the customer data file
  178.         If validation.presenceCheck(txt_search.Text) = True And txt_search.Text <> "Search by CustomerID" Then 'if validation is true
  179.             While sr.Peek() >= 0 'while there are records to read
  180.                 recordCount = recordCount + 1 'count the amount of records stored
  181.                 record = encryption.decrypt(sr.ReadLine) 'decrypt the record
  182.                 fields = record.Split(",") 'split tje record into fields
  183.                 If fields(0) = txt_search.Text Then 'if the ID being searched for is found in the record
  184.                     dgv_customerData.ClearSelection() 'unselect selected row
  185.                     dgv_customerData.Rows(recordCount - 1).Selected = True 'make the found record be selected
  186.                     found = True 'has been found
  187.                 ElseIf recordCount = lineCount And found = False Then 'if the record isnt present
  188.                     MsgBox("There is customer with that ID") 'notify user
  189.                 End If
  190.             End While
  191.         Else
  192.             MsgBox("You must fill out all fields") 'notify user
  193.         End If
  194.         txt_search.Text = "Search by CustomerID" 'reset text boxes
  195.     End Sub
  196.     Private Sub btn_overwrite_Click(sender As Object, e As EventArgs) Handles btn_overwrite.Click
  197.         Dim swTemp As New StreamWriter("tempCustomerData.txt", False) 'empties the tempBooks file for use in this subroutine
  198.         swTemp.Close() 'A temp file must be used so that the stream reader reads correctly while the streamwriter writes
  199.         Dim validation As New clsValidation 'instantiate classes
  200.         Dim encryption As New clsEncryption
  201.         Dim editCustomerName As String 'details to overwrite with
  202.         Dim editSurname As String
  203.         Dim editDOB As String
  204.         Dim editEmail As String
  205.         Dim editPhoneNumber As String
  206.         Dim editPostcode As String
  207.         Dim editAccountID As String
  208.         Dim validated As Boolean = True 'is data validated
  209.         Dim IDValidated As Boolean = True 'is ID validated
  210.         Dim searchID As String 'the ID being searched for
  211.         Dim record As String 'a record from the file
  212.         Dim fields() As String 'the fields in the record
  213.         Dim found As Boolean = False 'has the record been found
  214.         If validation.presenceCheck(txt_customerName.Text) = True And txt_customerName.Text <> "Customer Name" Then 'presence check
  215.             editCustomerName = txt_customerName.Text 'set values
  216.         Else
  217.             validated = False 'doesnt meet validations
  218.         End If
  219.         If validation.presenceCheck(txt_surname.Text) = True And txt_surname.Text <> "Surname" Then
  220.             editSurname = txt_surname.Text 'same as customer name
  221.         Else
  222.             validated = False
  223.         End If
  224.         If validation.presenceCheck(txt_DOB.Text) = True And txt_surname.Text <> "Date of Birth" And validation.lengthCheck(txt_DOB.Text, 10, 10) Then
  225.             editDOB = txt_DOB.Text 'same as customer name but also checks it is 10 characters
  226.         Else
  227.             validated = False
  228.         End If
  229.         If validation.presenceCheck(txt_email.Text) = True And txt_email.Text <> "Email" Then
  230.             editEmail = txt_email.Text
  231.         Else
  232.             validated = False
  233.         End If
  234.         If validation.presenceCheck(txt_phoneNumber.Text) = True And txt_phoneNumber.Text <> "Phone Number" And validation.lengthCheck(txt_phoneNumber.Text, 11, 11) Then
  235.             editPhoneNumber = txt_phoneNumber.Text 'same as DOB but with 11 characters
  236.         Else
  237.             validated = False
  238.         End If
  239.         If validation.presenceCheck(txt_postcode.Text) = True And txt_postcode.Text <> "Postcode" Then
  240.             editPostcode = txt_postcode.Text
  241.         Else
  242.             validated = False
  243.         End If
  244.         If validation.presenceCheck(txt_accountID.Text) = True And txt_accountID.Text <> "AccountID" Then
  245.             editAccountID = txt_accountID.Text
  246.         Else
  247.             validated = False
  248.         End If
  249.         If validation.presenceCheck(txt_CustomerID.Text) = True And txt_CustomerID.Text <> "CustomerID" Then 'Make sure and ID is entered
  250.             searchID = txt_CustomerID.Text
  251.         Else
  252.             IDValidated = False
  253.             MsgBox("Must enter an ID to replace the record of") 'notify user
  254.         End If
  255.         If IDValidated = True And validated = True Then 'If all validation is true
  256.             Dim sr As New StreamReader("customerData.txt") 'stream reader of the customer data file
  257.             Dim swTemp2 As New StreamWriter("tempCustomerData.txt", True) 'stream writer of the temp file that appends
  258.             While sr.Peek() >= 0 'if there are records to read
  259.                 record = encryption.decrypt(sr.ReadLine) 'read line unencrypted
  260.                 fields = record.Split(",") 'split into fields
  261.                 If fields(0) <> searchID Then 'if the ID is not the ID being seached for
  262.                     swTemp2.WriteLine(encryption.encrypt(record)) 'Write old line into temp file
  263.                 Else
  264.                     swTemp2.WriteLine(encryption.encrypt(searchID & "," & editCustomerName & "," & editSurname & "," & editDOB & "," & editEmail & "," & editEmail & "," & editPhoneNumber & "," & editPostcode & "," & editAccountID)) 'adds new edited data to the temp file
  265.                     found = True 'has been found
  266.                 End If
  267.             End While
  268.             sr.Close() 'close stream reader
  269.             swTemp2.Close() 'close stream writer
  270.         Else
  271.             MsgBox("Must meet all validation requirements") 'notify user
  272.         End If
  273.         If found = True Then 'if it has been found
  274.             Dim srTemp As New StreamReader("tempCustomerData.txt") 'stream reader of the temp file
  275.             Dim sw As New StreamWriter("customerData.txt", False) 'will overwrite previous file
  276.             sw.Close() 'close stream writer
  277.             Dim sw1 As New StreamWriter("customerData.txt", True) 'stream writer to append file
  278.             While srTemp.Peek() >= 0
  279.                 record = srTemp.ReadLine 'each record from the temp file
  280.                 sw1.WriteLine(record) 'write the record from the temp file into the normal file (overwriting)
  281.             End While
  282.             srTemp.Close() 'close stream readers and writers
  283.             sw1.Close()
  284.         Else
  285.             MsgBox("No record found with that ID") 'notify user
  286.         End If
  287.         fillGrid()
  288.     End Sub
  289.     Private Sub btn_delete_Click(sender As Object, e As EventArgs) Handles btn_delete.Click
  290.         Dim swTemp As New StreamWriter("tempCustomerData.txt", False) 'empties the tempBooks file for use in this subroutine
  291.         swTemp.Close() 'A temp file must be used so that the stream reader reads correctly while the streamwriter writes
  292.         Dim validation As New clsValidation 'instantiate classes
  293.         Dim encryption As New clsEncryption
  294.         Dim validated As Boolean = True 'is data validated
  295.         Dim IDValidated As Boolean = True 'is ID validated
  296.         Dim searchID As String 'the ID to search for
  297.         Dim record As String 'a record from the file
  298.         Dim fields() As String 'the fields in the record
  299.         Dim found As Boolean = False
  300.         If validation.presenceCheck(txt_CustomerID.Text) = True And txt_CustomerID.Text <> "CustomerID" Then 'Make sure and ID is entered
  301.             searchID = txt_CustomerID.Text 'set value
  302.         Else
  303.             IDValidated = False 'doesnt meet validation
  304.             MsgBox("Must enter an ID to replace the record of") 'notify user
  305.         End If
  306.         If IDValidated = True And validated = True Then 'If all validation is true
  307.             found = True 'has been found
  308.             Dim sr As New StreamReader("customerData.txt") 'stream reader of the customer data file
  309.             Dim swTemp2 As New StreamWriter("tempCustomerData.txt", True) 'stream reader to append temp file
  310.             While sr.Peek() >= 0 'while there are records to read
  311.                 record = encryption.decrypt(sr.ReadLine) 'read line unencrypted
  312.                 fields = record.Split(",") 'split record
  313.                 If fields(0) <> searchID Then 'if record doesnt have the ID
  314.                     swTemp2.WriteLine(encryption.encrypt(record)) 'Write old line into temp file
  315.                 End If
  316.             End While
  317.             sr.Close() 'close stream readers and writers
  318.             swTemp2.Close()
  319.         Else
  320.             MsgBox("Must meet all validation requirements") 'notify user
  321.         End If
  322.         If found = True Then
  323.             Dim srTemp As New StreamReader("tempCustomerData.txt") 'stream reader of temp file
  324.             Dim sw As New StreamWriter("customerData.txt", False) 'will overwrite previous file
  325.             sw.Close() 'close stream writer
  326.             Dim sw1 As New StreamWriter("customerData.txt", True) 'stream writer to append file
  327.             While srTemp.Peek() >= 0
  328.                 record = srTemp.ReadLine 'each record from the temp file
  329.                 sw1.WriteLine(record) 'write the record from the temp file into the normal file (overwriting)
  330.             End While
  331.             srTemp.Close() 'close stream readers and writers
  332.             sw1.Close()
  333.         Else
  334.             MsgBox("No record found with that ID") 'notify user
  335.         End If
  336.         fillGrid()
  337.     End Sub
  338.     Private Sub btn_first_Click(sender As Object, e As EventArgs) Handles btn_first.Click
  339.         dgv_customerData.ClearSelection()
  340.         dgv_customerData.Rows(0).Selected = True 'gp back to the first record
  341.         rowIndex = 0
  342.     End Sub
  343.  
  344.     Private Sub btn_previous_Click(sender As Object, e As EventArgs) Handles btn_previous.Click
  345.         dgv_customerData.ClearSelection()
  346.         If rowIndex = 0 Then
  347.             MsgBox("You are already looking at the first record")
  348.         Else
  349.             rowIndex = rowIndex - 1
  350.             dgv_customerData.Rows(rowIndex).Selected = True 'go one record back unless you are at the fist one already
  351.         End If
  352.     End Sub
  353.  
  354.     Private Sub btn_next_Click(sender As Object, e As EventArgs) Handles btn_next.Click
  355.         dgv_customerData.ClearSelection()
  356.         If rowIndex = lineCount - 1 Then
  357.             MsgBox("You are already looking at the last record")
  358.         Else
  359.             rowIndex = rowIndex + 1
  360.             dgv_customerData.Rows(rowIndex).Selected = True 'go on record forwards unless you are at the last one already
  361.         End If
  362.     End Sub
  363.  
  364.     Private Sub btn_last_Click(sender As Object, e As EventArgs) Handles btn_last.Click
  365.         dgv_customerData.ClearSelection()
  366.         dgv_customerData.Rows(lineCount - 1).Selected = True 'go to the last record stored
  367.         rowIndex = lineCount - 1
  368.     End Sub
  369.     Private Sub pbx_back_Click(sender As Object, e As EventArgs) Handles pbx_back.Click
  370.         Dim MainMenu As New MainMenu 'new instance of main menu form
  371.         MainMenu.Show() 'show new form
  372.         Me.Close() 'close current form
  373.     End Sub
  374.     Private Sub pbx_back_MouseHover(sender As Object, e As EventArgs) Handles pbx_back.MouseHover
  375.         Dim startupPath As String 'stores location the program is running
  376.         startupPath = Application.StartupPath
  377.         pbx_back.ImageLocation = startupPath & "\ArrowRollover.png" 'rollover
  378.     End Sub
  379.  
  380.     Private Sub pbx_back_MouseLeave(sender As Object, e As EventArgs) Handles pbx_back.MouseLeave
  381.         Dim startupPath As String 'stores location the program is running
  382.         startupPath = Application.StartupPath
  383.         pbx_back.ImageLocation = startupPath & "\Arrow.png" 'back to normal
  384.     End Sub
  385.  
  386.     Private Sub txt_customerName_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_customerName.MouseClick
  387.         If txt_customerName.Text = "Customer Name" Then 'if text is starting text
  388.             txt_customerName.Text = "" 'clear text box
  389.         End If
  390.     End Sub
  391.  
  392.     Private Sub txt_surname_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_surname.MouseClick
  393.         If txt_surname.Text = "Surname" Then 'same as customer name text box
  394.             txt_surname.Text = ""
  395.         End If
  396.     End Sub
  397.  
  398.     Private Sub txt_DOB_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_DOB.MouseClick
  399.         If txt_DOB.Text = "Date of Birth" Then
  400.             txt_DOB.Text = ""
  401.         End If
  402.     End Sub
  403.  
  404.     Private Sub txt_email_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_email.MouseClick
  405.         If txt_email.Text = "Email" Then
  406.             txt_email.Text = ""
  407.         End If
  408.     End Sub
  409.  
  410.     Private Sub txt_phoneNumber_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_phoneNumber.MouseClick
  411.         If txt_phoneNumber.Text = "Phone Number" Then
  412.             txt_phoneNumber.Text = ""
  413.         End If
  414.     End Sub
  415.  
  416.     Private Sub txt_postcode_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_postcode.MouseClick
  417.         If txt_postcode.Text = "Postcode" Then
  418.             txt_postcode.Text = ""
  419.         End If
  420.     End Sub
  421.  
  422.     Private Sub txt_accountID_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_accountID.MouseClick
  423.         If txt_accountID.Text = "AccountID" Then
  424.             txt_accountID.Text = ""
  425.         End If
  426.     End Sub
  427.  
  428.     Private Sub txt_CustomerID_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_CustomerID.MouseClick
  429.         If txt_CustomerID.Text = "CustomerID" Then
  430.             txt_CustomerID.Text = ""
  431.         End If
  432.     End Sub
  433.  
  434.     Private Sub txt_search_MouseClick(sender As Object, e As MouseEventArgs) Handles txt_search.MouseClick
  435.         If txt_search.Text = "Search by CustomerID" Then
  436.             txt_search.Text = ""
  437.         End If
  438.     End Sub
  439.  
  440.     Private Sub rbt_sortCustomerID_CheckedChanged(sender As Object, e As EventArgs) Handles rbt_sortCustomerID.CheckedChanged
  441.         bubbleSort(0) 'sort by ID
  442.     End Sub
  443.  
  444.     Private Sub rbt_sortCustomerName_CheckedChanged(sender As Object, e As EventArgs) Handles rbt_sortCustomerName.CheckedChanged
  445.         bubbleSort(1) 'sort by customer name
  446.     End Sub
  447. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement