0% found this document useful (0 votes)
21 views13 pages

Library Management System Project

This document describes a library management system project created by three batch members using Visual Studio. The project aims to build a library management system to manage books and customer accounts. It lists the required components as a system, Windows operating system, and Visual Studio. It includes code snippets from the main form and customer form to demonstrate functionality for viewing and searching customer records.

Uploaded by

Prince. Daf
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views13 pages

Library Management System Project

This document describes a library management system project created by three batch members using Visual Studio. The project aims to build a library management system to manage books and customer accounts. It lists the required components as a system, Windows operating system, and Visual Studio. It includes code snippets from the main form and customer form to demonstrate functionality for viewing and searching customer records.

Uploaded by

Prince. Daf
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CBT LAB MINI PROJECT

BATCH-6
LIBARY MANAGEMENT SYSTEM
BATCH MEMBERS

[Link] 19DI17

[Link] PRATHIUSHA 19DI23

[Link] 19DI35
AIM:
To build a Library management system using visual studio
COMPONENTS REQUIRED:

[Link]. FACILITIES REQUIRED QUANTITY

1 SYSTEM 1

2 O/S WINDOWS

5 VS studio 1

CODE:

[Link]
Public Class MainForm

Private Sub MainForm_FormClosing(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
[Link] = [Link]
[Link] = [Link]
[Link]()
End Sub

Private Sub MainForm_Load(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Try
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]([Link])
Catch ex As Exception

End Try
End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub AddBooksToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub
Private Sub IssueBookToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub ReturnBookToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub BookReportToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim child As Form
For Each child In MdiChildren
[Link]()
Next
End Sub

Private Sub AddGroupToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub PictureToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
With OpenFileDialog1
.FileName = ""
.Filter = ".jpg|*.jpg|.png|*.png|.gif|*.gif|.bmp|*.bmp"
End With
If [Link] = [Link] Then
[Link] = True
Dim BackFile As String
BackFile = [Link]
[Link] = [Link](BackFile)
[Link] = BackFile
[Link]()
End If
End Sub

Private Sub AddCustomerToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub ViewCustomerToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub HelpToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub

Private Sub BackgroundToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

End Sub

Private Sub AllRentedToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = Me
[Link]()
End Sub
End Class

[Link]
Public Class CustomerDetail
Public curr As String = [Link]
Private Sub CustomerDetail_Load(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Call readDataW()
End Sub
Sub readDataW()
[Link]("CUSTOMER ID", 90, [Link])
[Link]("CUSTOMER NAME", 140, [Link])
[Link]("CUSTOMER ADDRESS", 140, [Link])
[Link]("CONTACT NUMBER", 120, [Link])
[Link]("SECURITY AMOUNT", 120, [Link])
[Link]("ACTIVATION DATE", 120, [Link])
[Link]("VALID TILL", 120, [Link])
[Link] = [Link]
End Sub
Sub readData()
[Link]()
[Link]("CUSTOMER ID", 90, [Link])
[Link]("CUSTOMER NAME", 140, [Link])
[Link]("CUSTOMER ADDRESS", 140, [Link])
[Link]("CONTACT NUMBER", 120, [Link])
[Link]("SECURITY AMOUNT", 120, [Link])
[Link]("ACTIVATION DATE", 120, [Link])
[Link]("VALID TILL", 120, [Link])
[Link] = [Link]
Try

If ([Link] = [Link]) Then [Link]()


com = New [Link]("SELECT * FROM Customer", objcon)
dr = [Link]
While [Link]()
Call adddatatolistview(ListView1, dr(0), dr(1), dr(2), dr(3), dr(4), dr(5), dr(6))
End While
[Link]()
[Link]()
Catch
'MsgBox("Please Refresh", [Link], "")
End Try
End Sub
Public Sub adddatatolistview(ByVal lvw As ListView, ByVal CID As String, ByVal CName As String,
ByVal CAddress As String, ByVal CCont As String, ByVal Sec As String, ByVal CAct As String, ByVal
CVal As String)
Dim lv As New ListViewItem
[Link](lv)
[Link] = CID
[Link](CName)
[Link](CAddress)
[Link](CCont)
[Link](curr + " " + Sec)
[Link](CAct)
[Link](CVal)
End Sub

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
If [Link] = "" Then
Call readData()
Else
[Link]()
[Link]("CUSTOMER ID", 90, [Link])
[Link]("CUSTOMER NAME", 140, [Link])
[Link]("CUSTOMER ADDRESS", 140, [Link])
[Link]("CONTACT NUMBER", 120, [Link])
[Link]("SECURITY AMOUNT", 120, [Link])
[Link]("ACTIVATION DATE", 120, [Link])
[Link]("VALID TILL", 120, [Link])
[Link] = [Link]
Try

If ([Link] = [Link]) Then [Link]()


com = New [Link]("SELECT * FROM Customer WHERE CID='" &
[Link] & "'", objcon)
dr = [Link]
While [Link]()
Call adddatatolistview(ListView1, dr(0), dr(1), dr(2), dr(3), dr(4), dr(5), dr(6))
End While
[Link]()
[Link]()
Catch

End Try
End If
End Sub
Sub displayThem()

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim i As Integer
[Link]()
[Link]()
Try
If [Link] = "" Then

Else
For i = 0 To [Link] - 1
If [Link] = [Link](i).SubItems(0).Text Then
[Link](i).Selected = True
Exit For
End If
Next
End If
Catch

End Try
End Sub
End Class

[Link]
Public Class AddCustomer
Public NameFrm, NameTo As String
Public curr As String = [Link]
Private Sub TextBox4_KeyDown(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]

End Sub
Private Sub TextBox4_LostFocus(ByVal sender As Object, ByVal e As [Link]) Handles
[Link]
[Link] = [Link]
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]

End Sub

Private Sub Button9_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
[Link]()
End Sub

Private Sub TextBox2_LostFocus(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]
NameFrm = [Link]
Call Sentence()
[Link] = NameTo
End Sub

Private Sub TextBox2_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]

End Sub
Sub Sentence()
Dim a, b As Integer
a = [Link]
NameTo = ""
For b = 0 To a - 1
If b = 0 Then
If [Link](NameFrm(0)) Then
NameTo = [Link](NameFrm(0))
Else
NameTo = NameFrm(0)
End If
Else
If NameFrm(b - 1) = " " Then
NameTo = NameTo + [Link](NameFrm(b))
Else
NameTo = NameTo + NameFrm(b)
End If
End If
Next
End Sub

Private Sub TextBox3_LostFocus(ByVal sender As Object, ByVal e As [Link]) Handles


[Link]
NameFrm = [Link]
Call Sentence()
[Link] = NameTo
End Sub

Private Sub TextBox3_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
If [Link] = "" Then
MsgBox("Please enter a Customer ID", 0, "")
Else
Try
If [Link] = [Link] Then [Link]()
com = New [Link]("INSERT INTO Customer values('" & [Link] &
"','" & [Link] & "','" & [Link] & "','" & [Link] & "','" & [Link] & "','"
& [Link] & "','" & [Link] & "')", objcon)
If [Link]() Then MsgBox("Saved Success!", 0, "")
[Link]()
Call readData()
[Link]()
Call DisableThem()
Catch ex As Exception
MsgBox([Link], 0, "")
End Try
End If
End Sub

Private Sub Button8_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
If [Link] = "" Then
MsgBox("Please enter the ID to be deleted!", 0, "")
Else
Try
[Link]()
com = New [Link]("delete from Customer where CID='" &
[Link] & "'", objcon)
If [Link]() Then
[Link]()
Call readData()
MsgBox("Deleted Success!", 0, "")
Else
MsgBox("ID Not Found!", 0, "")
End If

[Link]()
Catch ex As Exception
MsgBox([Link], 0, "")
End Try
End If
End Sub

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Call EnableThem()
Call ClearField()
End Sub
Sub EnableThem()
[Link] = True
[Link] = True
[Link] = True
[Link] = True
[Link] = True
[Link] = True
[Link] = True
End Sub
Sub DisableThem()
'[Link] = False
[Link] = False
[Link] = False
[Link] = False
[Link] = False
[Link] = False
[Link] = False
End Sub

Private Sub AddCustomer_Load(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Call DisableThem()
Call readData()
End Sub
Sub readData()
[Link]("CUSTOMER ID", 90, [Link])
[Link]("CUSTOMER NAME", 210, [Link])
[Link]("CUSTOMER ADDRESS", 130, [Link])
[Link]("CONTACT #", 90, [Link])
[Link]("SECURITY", 90, [Link])
[Link]("ACTIVATION DATE", 130, [Link])
[Link]("VALID TILL", 90, [Link])
Try

If ([Link] = [Link]) Then [Link]()


com = New [Link]("SELECT * FROM Customer", objcon)
dr = [Link]
While [Link]()
Call adddatatolistview(ListView1, dr(0), dr(1), dr(2), dr(3), dr(4), dr(5), dr(6))
End While
[Link]()
[Link]()
Catch
'MsgBox("Please Refresh", [Link], "")
End Try
End Sub
Public Sub adddatatolistview(ByVal lvw As ListView, ByVal CID As String, ByVal CName As String,
ByVal CAddress As String, ByVal CCont As String, ByVal Sec As String, ByVal CAct As String, ByVal
CVal As String)
Dim lv As New ListViewItem
[Link](lv)
[Link] = CID
[Link](CName)
[Link](CAddress)
[Link](CCont)
[Link](curr + " " + Sec)
[Link](CAct)
[Link](CVal)
End Sub
Sub ClearField()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
End Sub
Sub LoadInto()

End Sub

Private Sub Button5_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Try
Dim i As Integer
For i = 0 To [Link] - 1
If [Link](i).Selected = True Then
[Link] = [Link](i - 1).SubItems(0).Text
Exit For
End If
Next
[Link]()
[Link] = True
Catch ex As Exception
MsgBox([Link], 0, "")
End Try
End Sub

Private Sub Button6_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Try
Dim i As Integer
For i = 0 To [Link] - 1
If [Link](i).Selected = True Then
[Link] = [Link](i + 1).SubItems(0).Text
Exit For
End If
Next
[Link]()
[Link] = True
Catch ex As Exception
MsgBox([Link], 0, "")
End Try
End Sub

Private Sub ListView1_SelectedIndexChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim i As Integer
For i = 0 To [Link] - 1
If [Link](i).Selected = True Then
[Link] = [Link](i).SubItems(0).Text
[Link] = [Link](i).SubItems(1).Text
[Link] = [Link](i).SubItems(2).Text
[Link] = [Link](i).SubItems(3).Text
[Link] = [Link](i).SubItems(4).Text
[Link] = [Link](i).SubItems(5).Text
[Link] = [Link](i).SubItems(6).Text
Exit For
End If
Next
[Link]()
[Link] = True
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim i As Integer
[Link]()
[Link]()
Try
If [Link] = "" Then
[Link] = ""
Else
For i = 0 To [Link] - 1
If [Link] = [Link](i).SubItems(0).Text Then
[Link] = [Link](i).SubItems(1).Text
[Link](i).Selected = True
Exit For
End If
Next
End If
Catch

End Try
End Sub
End Class
OUTPUT:

RESULT:

THUS THE PROGRAM EXECUTED SUCCESSFULLY

Common questions

Powered by AI

The Library Management System ensures database connection integrity by explicitly checking and managing connection states before executing database operations. Prior to any SQL execution, such as SELECT, INSERT, or DELETE commands, the system checks if the `objcon` object state is closed, and opens the connection if necessary. After successful data retrieval or manipulation, the connection is closed to prevent resource leaks and ensure data integrity. This meticulous handling of connection states aids in maintaining reliable operations and avoids potential database lock or concurrency issues .

The Library Management System handles closing the main form through the MainForm_FormClosing event. When this event is triggered, the form's size and location are saved to the application settings, ensuring that the user's layout preferences are preserved for future sessions. This is achieved by using the My.Settings.MainSize and My.Settings.MainLocation properties, which are assigned the current form's Size and Location respectively, followed by calling My.Settings.Save() to persist these changes .

Customer data is managed and displayed through the CustomerDetail class, which utilizes a ListView to present customer information. Columns in the ListView are created to display various fields such as CUSTOMER ID, NAME, ADDRESS, CONTACT NUMBER, SECURITY AMOUNT, ACTIVATION DATE, and VALID TILL. Data is fetched from a database using an OleDbCommand to execute a SQL SELECT query. The retrieved data is then processed with the help of a reader and displayed in the ListView via the adddatatolistview method. This approach combines both data management through database operations and user interface considerations by updating the ListView dynamically with database content .

The AddGroupToolStripMenuItem_Click event in the Library Management System is designed to handle the creation and display of a new instance of the GroupID form. This event makes the form a child of the main form using the MdiParent property and opens it with the Show method. The functionality allows the user to manage group-specific operations within the library system, enhancing the administrative capabilities of the application by organizing customer or book entities into groups .

User settings for the application's interface in the Library Management System are managed using the My.Settings properties. The interface settings, such as form size, location, and background image, are stored within these properties. During the MainForm_Load event, these settings are re-applied to configure the form based on the last saved state, using My.Settings.MainSize and My.Settings.MainLocation for dimensions and My.Settings.MainImage for the background. This mechanism ensures that the layout and appearance remain consistent across sessions, leveraging persistent settings in a Windows Forms application .

The method implemented to add new books in the Library Management System is via the AddBooksToolStripMenuItem_Click event. When triggered, this event handler creates a new instance of the AddBooks form, assigns the main form as its parent MDI (Multiple Document Interface), and displays it to the user using the Show method. This integrates with the user interface by allowing seamless interaction and management of book additions directly from the system's menu .

The PictureToolStripMenuItem_Click event allows users to customize the library management system's interface by selecting an image to set as the background. It uses an OpenFileDialog to let users pick an image file from their system. Once a file is chosen, it assigns the file path to the MainImage setting and updates the form's BackgroundImage. This customization adds personal usability and visual appeal, ensuring an engaging user interface that can be altered according to aesthetic preferences .

The Library Management System employs a combination of ListView manipulation and database queries to refresh the customer list view after database changes. After executing data-altering operations, such as additions or deletions, the system calls the readData method to reload the ListView. This method clears the existing list and fetches the most recent customer data from the database, re-populating the ListView with updated records to reflect any modifications accurately to the user interface .

The implementation for customer addition involves the Button2_Click event, which checks for a valid Customer ID, then performs an INSERT operation into the database using OleDbCommand, provided the connection to the database is open. If successful, a confirmation message is displayed, and the ListView is refreshed with updated customer data. Similarly, customer deletion is handled through the Button8_Click event, which executes a DELETE command based on the Customer ID input. Both operations are wrapped in try-catch blocks to handle potential exceptions, ensuring robustness in data manipulation processes. This design effectively manages customer data through established database procedures .

The EnableThem and DisableThem methods in the Library Management System serve to control user interaction with input fields. EnableThem allows input fields to be editable, thereby enabling user data entry, whereas DisableThem prevents modification by making the fields non-editable until certain conditions are met. This control is crucial in ensuring that the input sequence follows proper workflows, such as ensuring a customer record is properly saved before additional modifications can be made, thereby maintaining database integrity and user guidance during interactions .

You might also like