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