Advertisement
ElliottE4

Untitled

Feb 18th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.43 KB | None | 0 0
  1. Public Class LibraryMenu
  2.     Private Sub LibraryMenu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  3.  
  4.         If Security = 1 Then 'if the access level linked to the user is 1 then:
  5.  
  6.             btn_Members.BackColor = Color.Gray 'make the colour of the member form button gray to show that it is inaccessible
  7.             Me.Text = "Menu: Librarian" 'rename the form to show the access level of the user
  8.             btn_Members.Enabled = False 'disable the use of the member button
  9.  
  10.         End If
  11.  
  12.         If Security = 2 Then 'if the access level linked to the user is 2 then:
  13.  
  14.             Me.Text = "Menu: Receptionist" 'rename the form to show the access level of the user
  15.  
  16.         End If
  17.  
  18.         If Security = 3 Then 'if the access level linked to the user is 3 then:
  19.  
  20.             Me.Text = "Menu: Admin" 'rename the form to show the access level of the user
  21.  
  22.         End If
  23.  
  24.  
  25.     End Sub
  26.  
  27.     Private Sub pbx_ExitButton_Click(sender As Object, e As EventArgs) Handles pbx_ExitButton.Click
  28.  
  29.         If MsgBox("Are you sure you want to quit the program?", vbYesNo) = vbYes Then
  30.  
  31.             'when the exit button is clicked, exit the program if yes is selected
  32.             Application.Exit() 'exit the program
  33.  
  34.         End If
  35.  
  36.     End Sub
  37.  
  38.     Private Sub btn_Staff_Click(sender As Object, e As EventArgs) Handles btn_Staff.Click
  39.  
  40.         Dim staff As New Staff 'creates new instance of the staff form
  41.         staff.Show() 'shows the staff form
  42.         Me.Close() 'closes the currrent form
  43.  
  44.     End Sub
  45.  
  46.     Private Sub btn_Members_Click(sender As Object, e As EventArgs) Handles btn_Members.Click
  47.  
  48.         Dim member As New Member 'creates new instance of the member form
  49.         member.Show() 'shows the member form
  50.         Me.Close() 'closes the currrent form
  51.  
  52.     End Sub
  53.  
  54.     Private Sub btn_Books_Click(sender As Object, e As EventArgs) Handles btn_Books.Click
  55.  
  56.         Dim books As New Books 'creates new instance of the books form
  57.         books.Show() 'shows the books form
  58.         Me.Close() 'closes the currrent form
  59.  
  60.     End Sub
  61.  
  62.     Private Sub btn_Help_Click(sender As Object, e As EventArgs) Handles btn_Help.Click
  63.  
  64.         Help.txt_help.Text = "This is the menu form. Click on one of the three buttons to be redirected to the respective form. " _
  65.             & "If you click the cross button in the top right of the form, you will exit the program."
  66.  
  67.         Help.Show()
  68.  
  69.     End Sub
  70. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement