Advertisement
UsernameHere1

Untitled

Feb 21st, 2024
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.11 KB | None | 0 0
  1. Public Class MainMenu 'main menu form
  2.     Private Sub MainMenu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  3.         Me.CenterToScreen()
  4.         btn_customerData.Visible = False 'Hide the buttons so that they can be revealed for the correct level of access
  5.         btn_borrowingData.Visible = False
  6.         btn_loginData.Visible = False
  7.         btn_backup.Visible = False
  8.         Dim startupPath As String 'store the location the file is running
  9.         startupPath = Application.StartupPath
  10.         If levelOfAccess = 3 Then
  11.             Me.BackColor = Color.FromArgb(247, 220, 143) 'For admins use yellow
  12.         End If
  13.         If levelOfAccess = 2 Then
  14.             Me.BackColor = Color.FromArgb(140, 227, 245) 'For librarians use a blue background instead of the standard green
  15.         End If
  16.         If levelOfAccess = 1 Then
  17.             Me.BackColor = Color.FromArgb(163, 255, 166) 'For customers use standard green
  18.         End If
  19.         If levelOfAccess = 3 Then
  20.             btn_loginData.Visible = True 'Make the login details form only accessible by admins
  21.             btn_backup.Visible = True
  22.         End If
  23.         If levelOfAccess > 1 Then
  24.             btn_customerData.Visible = True 'Make the customer data form and borrowing data form not available to customers
  25.             btn_borrowingData.Visible = True
  26.         End If
  27.         pbx_logo.ImageLocation = startupPath & "\PennardLibraryLogo.png" 'set image locations
  28.         pbx_exit.ImageLocation = startupPath & "\Exit.png"
  29.     End Sub
  30.     Private Sub pbx_exit_MouseHover(sender As Object, e As EventArgs) Handles pbx_exit.MouseHover 'rollover
  31.         Dim startupPath As String 'store the location the file is running
  32.         startupPath = Application.StartupPath
  33.         pbx_exit.ImageLocation = startupPath & "\ExitRollover.png" 'rollover image
  34.     End Sub
  35.  
  36.     Private Sub pbx_exit_MouseLeave(sender As Object, e As EventArgs) Handles pbx_exit.MouseLeave
  37.         Dim startupPath As String 'store the location the file is running
  38.         startupPath = Application.StartupPath
  39.         pbx_exit.ImageLocation = startupPath & "\Exit.png" 'back to normal image
  40.     End Sub
  41.     Private Sub pbx_exit_Click(sender As Object, e As EventArgs) Handles pbx_exit.Click
  42.         Application.Exit() 'close program
  43.     End Sub
  44.     Private Sub btn_logout_Click(sender As Object, e As EventArgs) Handles btn_logout.Click
  45.         Dim Login As New Login 'new instance of login form
  46.         Login.Show() 'show new form
  47.         Me.Close() 'close old form
  48.     End Sub
  49.  
  50.     Private Sub btn_catalogue_Click(sender As Object, e As EventArgs) Handles btn_catalogue.Click
  51.         Dim Catalogue As New Catalogue 'new instance of catalogue form
  52.         Catalogue.Show() 'show new form
  53.         Me.Close()  'close current form
  54.     End Sub
  55.  
  56.     Private Sub btn_dueDates_Click(sender As Object, e As EventArgs) Handles btn_dueDates.Click
  57.         Dim DueDates As New DueDates 'new instance of due dates form
  58.         DueDates.Show() 'show new form
  59.         Me.Close() 'close current form
  60.     End Sub
  61.  
  62.     Private Sub btn_customerData_Click(sender As Object, e As EventArgs) Handles btn_customerData.Click
  63.         Dim CustomerData As New CustomerData 'new instance of customer data form
  64.         CustomerData.Show() 'show new form
  65.         Me.Close() 'close current form
  66.     End Sub
  67.  
  68.     Private Sub btn_borrowingData_Click(sender As Object, e As EventArgs) Handles btn_borrowingData.Click
  69.         Dim BorrowingData As New BorrowingData 'new instance of borrowing data form
  70.         BorrowingData.Show() 'show new form
  71.         Me.Close() 'close current form
  72.     End Sub
  73.  
  74.     Private Sub btn_loginData_Click(sender As Object, e As EventArgs) Handles btn_loginData.Click
  75.         Dim LoginData As New LoginData 'new instance of login data form
  76.         LoginData.Show() 'show new form
  77.         Me.Close() 'close current form
  78.     End Sub
  79.  
  80.     Private Sub btn_backup_Click(sender As Object, e As EventArgs) Handles btn_backup.Click
  81.         Dim Backup As New Backup 'new instance of backup form
  82.         Backup.Show() 'show new form
  83.         Me.Close() 'close current form
  84.     End Sub
  85. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement