0% found this document useful (0 votes)
17 views134 pages

Employee Main

This document contains code for an employee management system. It includes functions for loading data from a database, clearing form fields, searching, navigating records, and deleting records. The code connects to a database and loads employee data into fields and a datagrid for viewing and editing records.

Uploaded by

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

Employee Main

This document contains code for an employee management system. It includes functions for loading data from a database, clearing form fields, searching, navigating records, and deleting records. The code connects to a database and loads employee data into fields and a datagrid for viewing and editing records.

Uploaded by

dragonaklevel7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 134

62

SOURCE CODE

Employee Main

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlException
Imports System.IO
Public Class FrmEmpMain
Dim cn As New SqlConnection
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim cm As New SqlCommand
Dim dt As New DataTable
Dim rdr As SqlDataReader
Dim bnd As BindingSource = New BindingSource()
Dim cs As String
Dim p As Integer
Dim k As Integer
Dim currentpos As Integer = 0
Dim itemid As Integer = 0

BCA PROJECT
63

Private Sub Form1_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
cs = "Server= localhost; Database=BOOTH;Integrated

Security=SSPI;"

cn = New SqlConnection(cs)
cm = New SqlCommand(cs, cn)
da = New SqlDataAdapter("Select * from EmpMain ", cs)
ds = New DataSet da.Fill(ds, " EmpMain ")

Timer1.Enabled = True
Timer1.Interval = 1000

AUTO()
clear()
dynamic()

End Sub

Private Sub BtnEMExit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMExit.Click
Me.Close()

End Sub

BCA PROJECT
64

Private Sub BtnEMCancel_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMCancel.Click
clear()

End Sub
Sub clear()
TxtEMEmpName.Text = ""
TxtEMFName.Text = ""
TxtEMMName.Text = ""
TxtEMRel.Text = ""
TxtEMGen.Text = ""
DtpEMDob.Text = ""
TxtEMCat.Text = ""
TxtEMMs.Text = ""
TxtEMBG.Text = ""
TxtEMLK.Text = ""
TxtEMPA.Text = ""
TxtEMPerA.Text = ""
TxtEMCA.Text = ""
TxtEMCN.Text = ""
TxtEMEmail.Text = "N/A"
TxtEMEduDetail.Text = ""
TxtEMGQual.Text = ""
TxtEMProQual.Text = ""
TxtEMExperience.Text = ""

BCA PROJECT
65

TxtEMEmpid.Text = ""
TxtEMPow.Text = ""
TxtEMDep.Text = ""
TxtEMDesig.Text = ""
CmbEMSal.Text = ""
JoinDate.Text = ""
TxtEMWorkTime.Text = ""
TxtEMWorkTimeTo.Text = ""
TxtEMRemarks.Text = "N/A"
AUTO()

End Sub
Sub dynamic()
ds = New DataSet()
da = New SqlDataAdapter("select * from EmpMain", cs)
da.Fill(ds, "EmpMain")
bnd = New BindingSource()
bnd.DataMember = "EmpMain"
bnd.DataSource = ds
DataGridView1.DataSource = bnd
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
TxtEMTime.Text = Date.Now.ToLongTimeString.ToString
TxtEMDay.Text = UCase(Date.Now.DayOfWeek.ToString())

BCA PROJECT
66

End Sub
Sub AUTO()

cn.Open()
cm.CommandText = "select EMSlNo from EmpMain"
rdr = cm.ExecuteReader()
While (rdr.Read())
p = rdr("EMSlNo").ToString
End While
cn.Close()
TxtEMSlNo.Text = p + 1

End Sub

Private Sub BtnEMDelete_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMDelete.Click
k = MsgBox("DO YOU WANT TO DELETE THE SELECTED
OPTION", MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()
cm.CommandText = "DELETE * FROM EmpMain
WHERE EMSlNo='" + TxtEMSlNo.Text + "' "

BCA PROJECT
67

Dim i As Integer = cm.ExecuteNonQuery

If i = 0 Then
MsgBox("SELECTED RECORD NOT FOUND")

Exit Sub
End If
cn.Close()

MsgBox(i.ToString + " RECORD OF SELECTED


CATEGORY DELETED SUCCESSFULLY ")
clear()
TxtEMSlNo.Text = ""
TxtEMSlNo.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()

End Try

dynamic()
End If

End Sub

BCA PROJECT
68

Private Sub BtnEMShow_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMShow.Click
If BtnEMShow.Text = "show" Then
DataGridView1.Visible = True
BtnEMShow.Text = "hide"
Else
BtnEMShow.Text = "show"
DataGridView1.Visible = False
End If
dynamic()

End Sub

Private Sub BtnEMSearch_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMSearch.Click
Dim m As String = ""
Dim p As Integer = 0
TxtEMSlNo.Enabled = True
If TxtEMSlNo.Text = "" Then
MsgBox("PLEASE ENTER THE EMSlNo FOR SEARCHING ")
TxtEMSlNo.Focus()
Exit Sub
End If
cn.Open()

BCA PROJECT
69

cm.CommandText = "select EMSlNo from EmpMain"


rdr =
cm.ExecuteReader(CommandBehavior.SequentialAccess)
While (rdr.Read())
m = rdr("EMSlNo").ToString

If TxtEMSlNo.Text = m Then
p = p + 1
End If

End While
cn.Close()

If p = 0 Then
MsgBox("GIVEN VALUE NOT FOUND")
clear()
TxtEMSlNo.Focus()
DataGridView1.Visible = False
Else
MsgBox("GIVEN VALUE ALREADY PRESENT ")
BtnEMShow.Text = "Hidedata"
DataGridView1.Visible = True

ds = New DataSet()
da = New SqlDataAdapter("Select * From EmpMain
where ESSlNo=" + TxtEMSlNo.Text + "", cs)

BCA PROJECT
70

da.Fill(ds, "EmpMain")
bnd = New BindingSource()
bnd.DataMember = "EmpMain"
bnd.DataSource = ds
DataGridView1.DataSource = bnd

End If

End Sub
Private Sub BtnEMFirst_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnEMFirst.Click
bnd.MoveFirst()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BTNEMNext_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BTNEMNext.Click
bnd.MoveNext()
currentpos = bnd.Position
callingA()
End Sub

BCA PROJECT
71

Private Sub BtnEMPrevious_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMPrevious.Click
bnd.MovePrevious()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BtnEMLast_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMLast.Click
bnd.MoveLast()
currentpos = bnd.Position
callingA()
End Sub
Sub callingA()

TxtEMSlNo.Text =
ds.Tables(0).Rows(currentpos).Item("EMSlNo").ToString
TxtEMEmpName.Text =
ds.Tables(0).Rows(currentpos).Item("EMEmpName").ToString
TxtEMFName.Text =
ds.Tables(0).Rows(currentpos).Item("EMFName").ToString
TxtEMMName.Text =
ds.Tables(0).Rows(currentpos).Item("EMMName").ToString

BCA PROJECT
72

TxtEMRel.Text =
ds.Tables(0).Rows(currentpos).Item("EMRel").ToString
TxtEMGen.Text =
ds.Tables(0).Rows(currentpos).Item("EMGen").ToString
DtpEMDob.Text =
ds.Tables(0).Rows(currentpos).Item("EMDob").ToString
TxtEMCat.Text =
ds.Tables(0).Rows(currentpos).Item("EMCat").ToString
TxtEMMs.Text =
ds.Tables(0).Rows(currentpos).Item("EMMs").ToString
TxtEMBG.Text =
ds.Tables(0).Rows(currentpos).Item("EMBG").ToString
TxtEMLK.Text =
ds.Tables(0).Rows(currentpos).Item("EMLK").ToString
TxtEMPA.Text =
ds.Tables(0).Rows(currentpos).Item("EMPA").ToString
TxtEMPerA.Text =
ds.Tables(0).Rows(currentpos).Item("EMPerA").ToString
TxtEMCA.Text =
ds.Tables(0).Rows(currentpos).Item("EMCA").ToString
TxtEMCN.Text =
ds.Tables(0).Rows(currentpos).Item("EMCN").ToString
TxtEMEmail.Text =
ds.Tables(0).Rows(currentpos).Item("EMEmail").ToString
TxtEMEduDetail.Text =
ds.Tables(0).Rows(currentpos).Item("EMEduDetail").ToString

BCA PROJECT
73

TxtEMGQual.Text =
ds.Tables(0).Rows(currentpos).Item("EMGQual").ToString
TxtEMProQual.Text =
ds.Tables(0).Rows(currentpos).Item("EMProQual").ToString
TxtEMExperience.Text =
ds.Tables(0).Rows(currentpos).Item("EMExperience").ToString
TxtEMEmpid.Text =
ds.Tables(0).Rows(currentpos).Item("EMEmpid").ToString
TxtEMPow.Text =
ds.Tables(0).Rows(currentpos).Item("EMPow").ToString
TxtEMDep.Text =
ds.Tables(0).Rows(currentpos).Item("EMDep").ToString
TxtEMDesig.Text =
ds.Tables(0).Rows(currentpos).Item("EMDesig").ToString
CmbEMSal.Text =
ds.Tables(0).Rows(currentpos).Item("EMSal").ToString
JoinDate.Text =
ds.Tables(0).Rows(currentpos).Item("JoinDate").ToString
TxtEMWorkTime.Text =
ds.Tables(0).Rows(currentpos).Item("EMWorkTime").ToString
TxtEMWorkTimeTo.Text =
ds.Tables(0).Rows(currentpos).Item("EMWorkTimeTo").ToString
TxtEMRemarks.Text =
ds.Tables(0).Rows(currentpos).Item("EMRemarks").ToString

BCA PROJECT
74

End Sub

Private Sub BtnEMEdit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMEdit.Click
k = MsgBox("Update The Record...?",
MsgBoxStyle.YesNo)

If k = 6 Then
Try
cn.Open()
cm.CommandText = "UPDATE EmpMain SET
EMDate='" +
Me.DtpEMDate.Value.Date.ToShortDateString.ToString +
"',EMTime='" + TxtEMTime.Text + "',EMDay= '" + TxtEMDay.Text
+ "', EMEmpName='" + TxtEMEmpName.Text + "',EMFName='" +
TxtEMFName.Text + "',EMMName='" + TxtEMMName.Text +
"',EMRel='" + TxtEMRel.Text + "',EMGen='" + TxtEMGen.Text +
"',EMDob='" + DtpEMDob.Text + "',EMCat='" + TxtEMCat.Text +
"',EMMs='" + TxtEMMs.Text + "',EMBG='" + TxtEMBG.Text +
"',EMLK='" + TxtEMLK.Text + "',EMPA='" + TxtEMPA.Text +
"',EMPerA='" + TxtEMPerA.Text + "',EMCA='" + TxtEMCA.Text +
"',EMCN='" + TxtEMCN.Text + "',EMEmail='" + TxtEMEmail.Text
+ "',emedudetail='" + TxtEMEduDetail.Text + "',EMGQual= '" +
TxtEMGQual.Text + "',EMProQual='" + TxtEMProQual.Text +
"',EMExperience='" + TxtEMExperience.Text + "',EMEmpId='" +

BCA PROJECT
75

TxtEMEmpid.Text + "',EMPow='" + TxtEMPow.Text + "',EMDep='"


+ TxtEMDep.Text + "',EMDesig='" + TxtEMDesig.Text +
"',EMSal='" + CmbEMSal.Text + "',JoinDate='" + JoinDate.Text
+ "',EMWorkTime='" + TxtEMWorkTime.Text + "',EMRemarks='" +
TxtEMRemarks.Text + "' WHERE EMSlNo='" + TxtEMSlNo.Text +
"'"

Dim i As Integer = cm.ExecuteNonQuery


cn.Close()
MsgBox(i.ToString + " Record Updated")
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
dynamic()
Else
dynamic()
End If

End Sub

Private Sub BtnEMSave_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnEMSave.Click

BCA PROJECT
76

Try
cn.Open()

cm.CommandText = "Insert into


Empmain(EMDate,EMTime,EMDay,EMSlNo,EMEmpName,EMFName,EMMName
,EMRel,EMGen,EMDob,EMCat,EMMs,EMBG,EMLK,EMPA,EMPerA,EMCA,EMC
N,EMEmail,EMEduDetail,EMGQual,EMProQual,EMExperience,EMEmpid
,EMPow,EMDep,EMDesig,EMSal,JoinDate,EMWorkTime,EMWorkTimeTo,
EMRemarks) VALUES('" +
Me.DtpEMDate.Value.Date.ToShortDateString.ToString + "','" +
TxtEMTime.Text + "','" + TxtEMDay.Text + "','" +
TxtEMSlNo.Text + "','" + TxtEMEmpName.Text + "','" +
TxtEMFName.Text + "','" + TxtEMMName.Text + "','" +
TxtEMRel.Text + "','" + TxtEMGen.Text + "','" +
DtpEMDob.Text + "','" + TxtEMCat.Text + "','" + TxtEMMs.Text
+ "','" + TxtEMBG.Text + "','" + TxtEMLK.Text + "','" +
TxtEMPA.Text + "','" + TxtEMPerA.Text + "','" + TxtEMCA.Text
+ "','" + TxtEMCN.Text + "','" + TxtEMEmail.Text + "','" +
TxtEMEduDetail.Text + "','" + TxtEMGQual.Text + "','" +
TxtEMProQual.Text + "','" + TxtEMExperience.Text + "','" +
TxtEMEmpid.Text + "','" + TxtEMPow.Text + "','" +
TxtEMDep.Text + "','" + TxtEMDesig.Text + "','" +
CmbEMSal.Text + "','" + JoinDate.Text + "','" +
TxtEMWorkTime.Text + "','" + TxtEMWorkTimeTo.Text + "','" +
TxtEMRemarks.Text + "')"

BCA PROJECT
77

cm.ExecuteScalar()
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
Finally
cn.Close()
End Try
MsgBox("Record Saved ")

dynamic()
clear()
End Sub

Private Sub TxtEMEmpName_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMEmpName.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMFName.Focus()
End If
End Sub

Private Sub TxtEMFName_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMFName.KeyDown
If e.KeyCode = Keys.Enter Then

BCA PROJECT
78

TxtEMMName.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMEmpName.Focus()
End If

End Sub

Private Sub TxtEMMName_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMMName.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMRel.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMFName.Focus()
End If

End Sub

Private Sub TxtEMRel_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMRel.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMGen.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMMName.Focus()
End If

BCA PROJECT
79

End Sub

Private Sub TxtEMGen_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMGen.KeyDown
If e.KeyCode = Keys.Enter Then
DtpEMDob.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMRel.Focus()
End If

End Sub

Private Sub DtpEMDob_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
DtpEMDob.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMCat.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMGen.Focus()
End If

End Sub

BCA PROJECT
80

Private Sub TxtEMCat_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMCat.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMMs.Focus()
ElseIf e.KeyCode = Keys.Up Then
DtpEMDob.Focus()
End If

End Sub

Private Sub TxtEMMs_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMMs.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMBG.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMCat.Focus()
End If

End Sub

Private Sub TxtEMBG_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMBG.KeyDown
If e.KeyCode = Keys.Enter Then

BCA PROJECT
81

TxtEMLK.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMMs.Focus()
End If

End Sub

Private Sub TxtEMLK_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMLK.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMPA.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMBG.Focus()
End If

End Sub

Private Sub TxtEMPA_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMPA.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMPerA.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMLK.Focus()
End If

BCA PROJECT
82

End Sub

Private Sub TxtEMPerA_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMPerA.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMCA.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMPA.Focus()
End If

End Sub

Private Sub TxtEMCA_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMCA.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMCN.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMPerA.Focus()
End If

End Sub

BCA PROJECT
83

Private Sub TxtEMCN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMCN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMEmail.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMCA.Focus()
End If

End Sub

Private Sub TxtEMEmail_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMEmail.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMEduDetail.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMCN.Focus()
End If

End Sub

Private Sub TxtEMEduDetail_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles TxtEMEduDetail.KeyDown
If e.KeyCode = Keys.Enter Then

BCA PROJECT
84

TxtEMGQual.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMEmail.Focus()
End If

End Sub

Private Sub TxtEMGQual_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMGQual.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMProQual.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMEduDetail.Focus()
End If

End Sub

Private Sub TxtEMProQual_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMProQual.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMExperience.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMGQual.Focus()
End If

BCA PROJECT
85

End Sub

Private Sub TxtEMExperience_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles TxtEMExperience.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMEmpid.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMProQual.Focus()
End If

End Sub

Private Sub TxtEMEmpid_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMEmpid.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMPow.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMExperience.Focus()
End If

End Sub

BCA PROJECT
86

Private Sub TxtEMPow_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMPow.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMDep.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMEmpid.Focus()
End If

End Sub

Private Sub TxtEMDep_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMDep.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMDesig.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMPow.Focus()
End If

End Sub

Private Sub TxtEMDesig_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMDesig.KeyDown
If e.KeyCode = Keys.Enter Then

BCA PROJECT
87

CmbEMSal.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMDep.Focus()
End If

End Sub

Private Sub CmbEMSal_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
CmbEMSal.KeyDown
If e.KeyCode = Keys.Enter Then
JoinDate.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMDesig.Focus()
End If

End Sub

Private Sub JoinDate_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
JoinDate.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMWorkTime.Focus()
ElseIf e.KeyCode = Keys.Up Then
CmbEMSal.Focus()
End If

BCA PROJECT
88

End Sub

Private Sub TxtEMWorkTime_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles TxtEMWorkTime.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMWorkTimeTo.Focus()
ElseIf e.KeyCode = Keys.Up Then
JoinDate.Focus()
End If

End Sub

Private Sub TxtEMWorkTimeTo_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles TxtEMWorkTimeTo.KeyDown
If e.KeyCode = Keys.Enter Then
TxtEMRemarks.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMWorkTime.Focus()
End If

End Sub

BCA PROJECT
89

Private Sub TxtEMRemarks_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtEMRemarks.KeyDown
If e.KeyCode = Keys.Enter Then
BtnEMSave.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtEMWorkTimeTo.Focus()
End If

End Sub
Private Sub DataGridView1_DoubleClick(sender As Object,
e As System.EventArgs) Handles DataGridView1.DoubleClick
Dim idx As Integer
idx = DataGridView1.SelectedCells(0).RowIndex
DtpEMDate.Text =
DataGridView1.Rows(idx).Cells(0).Value.ToString
TxtEMTime.Text =
DataGridView1.Rows(idx).Cells(1).Value.ToString
TxtEMDay.Text =
DataGridView1.Rows(idx).Cells(2).Value.ToString
TxtEMSlNo.Text =
DataGridView1.Rows(idx).Cells(3).Value.ToString
TxtEMEmpName.Text =
DataGridView1.Rows(idx).Cells(4).Value.ToString
TxtEMFName.Text =
DataGridView1.Rows(idx).Cells(5).Value.ToString

BCA PROJECT
90

TxtEMMName.Text =
DataGridView1.Rows(idx).Cells(6).Value.ToString
TxtEMRel.Text =
DataGridView1.Rows(idx).Cells(7).Value.ToString
TxtEMGen.Text =
DataGridView1.Rows(idx).Cells(8).Value.ToString
DtpEMDob.Text =
DataGridView1.Rows(idx).Cells(9).Value.ToString
TxtEMCat.Text =
DataGridView1.Rows(idx).Cells(10).Value.ToString
TxtEMMs.Text =
DataGridView1.Rows(idx).Cells(11).Value.ToString
TxtEMBG.Text =
DataGridView1.Rows(idx).Cells(12).Value.ToString
TxtEMLK.Text =
DataGridView1.Rows(idx).Cells(13).Value.ToString
TxtEMPA.Text =
DataGridView1.Rows(idx).Cells(14).Value.ToString
TxtEMPerA.Text =
DataGridView1.Rows(idx).Cells(15).Value.ToString
TxtEMCA.Text =
DataGridView1.Rows(idx).Cells(16).Value.ToString
TxtEMCN.Text =
DataGridView1.Rows(idx).Cells(17).Value.ToString
TxtEMEmail.Text =
DataGridView1.Rows(idx).Cells(18).Value.ToString

BCA PROJECT
91

TxtEMEduDetail.Text =
DataGridView1.Rows(idx).Cells(19).Value.ToString
TxtEMGQual.Text =
DataGridView1.Rows(idx).Cells(20).Value.ToString
TxtEMProQual.Text =
DataGridView1.Rows(idx).Cells(21).Value.ToString
TxtEMExperience.Text =
DataGridView1.Rows(idx).Cells(22).Value.ToString
TxtEMEmpid.Text =
DataGridView1.Rows(idx).Cells(23).Value.ToString
TxtEMPow.Text =
DataGridView1.Rows(idx).Cells(24).Value.ToString
TxtEMDep.Text =
DataGridView1.Rows(idx).Cells(25).Value.ToString
TxtEMDesig.Text =
DataGridView1.Rows(idx).Cells(26).Value.ToString
CmbEMSal.Text =
DataGridView1.Rows(idx).Cells(27).Value.ToString
JoinDate.Text =
DataGridView1.Rows(idx).Cells(28).Value.ToString
TxtEMWorkTime.Text =
DataGridView1.Rows(idx).Cells(29).Value.ToString
TxtEMWorkTimeTo.Text =
DataGridView1.Rows(idx).Cells(30).Value.ToString
TxtEMRemarks.Text =
DataGridView1.Rows(idx).Cells(31).Value.ToString

BCA PROJECT
92

End Sub
End Class

Employee salary

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlException
Imports System.IO
Public Class FrmEmpSal

Dim cn As New SqlConnection


Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim cm As New SqlCommand
Dim dt As New DataTable
Dim rdr As SqlDataReader
Dim bnd As BindingSource = New BindingSource()
Dim cs As String
Dim p As Integer
Dim k As Integer
Dim currentpos As Integer = 0
Dim itemid As Integer = 0

BCA PROJECT
93

Private Sub EmpSal_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load
cs = "Server= localhost; Database=BOOTH;Integrated

Security=SSPI;"

cn = New SqlConnection(cs)
cm = New SqlCommand(cs, cn)
da = New SqlDataAdapter("Select * from EmpSal ", cs)
ds = New DataSet da.Fill(ds, " EmpSal ")

Timer1.Enabled = True
Timer1.Interval = 1000
DYNAMIC()
AUTO()

End Sub

Private Sub BtnESExit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESExit.Click
Me.Close()
End Sub
Sub Clear1()
TxtESEmpId.Text = ""
TxtESEmpName.Text = ""
TxtESDesig.Text = ""

BCA PROJECT
94

CmbESPMonth.Text = ""
CmbESPDay.Text = ""
CmbESLeavemonth.Text = ""
CmbESLMonthDay.Text = ""
TxtESBasicSal.Text = ""
TxtESAdvance.Text = ""
TxtESDues.Text = ""
TxtESDA.Text = ""
TxtESCCA.Text = ""
TxtESESI.Text = ""
TxtESPF.Text = ""
TxtESTotal.Text = ""
TxtESRemarks.Text = ""
End Sub
Private Sub BtnCancel_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnCancel.Click
Clear1()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Timer1.Tick
TxtESTime.Text = Date.Now.ToLongTimeString.ToString
TxtESDay.Text = UCase(Date.Now.DayOfWeek.ToString())

End Sub

BCA PROJECT
95

Sub AUTO()
'FUNCTION FOR SERIAL NO
cn.Open()
cm.CommandText = "select ESSlNO from empsal"
rdr = cm.ExecuteReader()
While (rdr.Read())
p = Val(rdr("ESSlNO").ToString)
End While
cn.Close()
TxtESSlNO.Text = p + 1

End Sub
Sub DYNAMIC()
ds = New DataSet()
da = New SqlDataAdapter("select * from Empsal", cs)
da.Fill(ds, "EmpSal")
bnd = New BindingSource()
bnd.DataMember = "EmpSal"
bnd.DataSource = ds
DataGridView2.DataSource = bnd
End Sub

Private Sub BtnESSave_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESSave.Click
Try

BCA PROJECT
96

cn.Open()
cm.CommandText = "Insert into
EmpSal(ESDate,ESTime,ESDay,ESSlNO,ESEmpid,ESEmpName,ESDesig,
ESPMonth,ESPDay,ESLeaveMonth,ESLMonthDay,ESBasicSal,ESAdvanc
e,ESDues,ESDA,ESCCA,ESESI,ESPF,ESTotal,ESRemarks) VALUES('"
+ DtpESDate.Text + "','" + TxtESTime.Text + "','" +
TxtESDay.Text + "','" + TxtESSlNO.Text + "','" +
TxtESEmpId.Text + "','" + TxtESEmpName.Text + "','" +
TxtESDesig.Text + "','" + CmbESPMonth.Text + "','" +
CmbESPDay.Text + "','" + CmbESLeavemonth.Text + "','" +
CmbESLMonthDay.Text + "','" + TxtESBasicSal.Text + "','" +
TxtESAdvance.Text + "','" + TxtESDues.Text + "','" +
TxtESDA.Text + "','" + TxtESCCA.Text + "','" + TxtESESI.Text
+ "','" + TxtESPF.Text + "','" + TxtESTotal.Text + "','" +
TxtESRemarks.Text + "')"

cm.ExecuteScalar()
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)

Finally

cn.Close()
End Try
MsgBox("Record Saved ")

BCA PROJECT
97

AUTO()
Clear1()
DYNAMIC()

End Sub

Private Sub BtnESDelete_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESDelete.Click

k = MsgBox("DO YOU WANT TO DELETE THE SELECTED


OPTION", MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()
cm.CommandText = "DELETE * FROM EmpSal WHERE
ESSlNO='" + TxtESSlNO.Text + "' "
Dim i As Integer = cm.ExecuteNonQuery

If i = 0 Then

BCA PROJECT
98

MsgBox("SELECTED RECORD NOT FOUND")

Exit Sub
End If
cn.Close()

MsgBox(i.ToString + " RECORD OF SELECTED


CATEGORY DELETED SUCCESSFULLY ")
Clear1()
TxtESSlNO.Text = ""
TxtESSlNO.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()

End Try
DYNAMIC()

End If
End Sub

Private Sub BtnESShow_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESShow.Click

BCA PROJECT
99

If BtnESShow.Text = "show" Then


DataGridView2.Visible = True
BtnESShow.Text = "hide"
Else
BtnESShow.Text = "show"
DataGridView2.Visible = False
BtnESShow.Text = "show"
End If
DYNAMIC()

End Sub

Private Sub BtnESSearch_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESSearch.Click

Dim m As String = ""


Dim p As Integer = 0
TxtESSlNO.Enabled = True
If TxtESSlNO.Text = "" Then
MsgBox("PLEASE ENTER THE ESSlNo FOR SEARCHING ")
TxtESSlNO.Focus()
Exit Sub
End If
cn.Open()
cm.CommandText = "select ESSlNo from EmpSal"

BCA PROJECT
100

rdr =
cm.ExecuteReader(CommandBehavior.SequentialAccess)
While (rdr.Read())
m = rdr("ESSlNo").ToString

If TxtESSlNO.Text = m Then
p = p + 1
End If

End While
cn.Close()

If p = 0 Then
MsgBox("GIVEN VALUE NOT FOUND")
Clear1()
TxtESSlNO.Focus()
DataGridView1.Visible = False
Else
MsgBox("GIVEN VALUE ALREADY PRESENT ")
BtnESShow.Text = "Hidedata"
DataGridView1.Visible = True

ds = New DataSet()
da = New SqlDataAdapter("Select * From EmpSal
where ESSlNo=" + TxtESSlNO.Text + "", cs)
da.Fill(ds, "EmpSal")

BCA PROJECT
101

bnd = New BindingSource()


bnd.DataMember = "EmpSal"
bnd.DataSource = ds
DataGridView1.DataSource = bnd

End If

End Sub

Private Sub BtnESFirst_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESFirst.Click
bnd.MoveFirst()
currentpos = bnd.Position
calling()

End Sub
Sub calling()

TxtESSlNO.Text =
ds.Tables(0).Rows(currentpos).Item("ESSlNO").ToString
TxtESEmpId.Text =
ds.Tables(0).Rows(currentpos).Item("ESEmpId").ToString
TxtESEmpName.Text =
ds.Tables(0).Rows(currentpos).Item("ESEmpName").ToString

BCA PROJECT
102

TxtESDesig.Text =
ds.Tables(0).Rows(currentpos).Item("ESDesig").ToString
CmbESPMonth.Text =
ds.Tables(0).Rows(currentpos).Item("ESPMonth").ToString
CmbESPDay.Text =
ds.Tables(0).Rows(currentpos).Item("ESPDay").ToString
CmbESLeavemonth.Text =
ds.Tables(0).Rows(currentpos).Item("ESLeavemonth").ToString
CmbESLMonthDay.Text =
ds.Tables(0).Rows(currentpos).Item("ESLMonthDay").ToString
TxtESBasicSal.Text =
ds.Tables(0).Rows(currentpos).Item("ESBasicSal").ToString
TxtESAdvance.Text =
ds.Tables(0).Rows(currentpos).Item("ESAdvance").ToString
TxtESDues.Text =
ds.Tables(0).Rows(currentpos).Item("ESDues").ToString
TxtESDA.Text =
ds.Tables(0).Rows(currentpos).Item("ESDA").ToString
TxtESCCA.Text =
ds.Tables(0).Rows(currentpos).Item("ESCCA").ToString
TxtESESI.Text =
ds.Tables(0).Rows(currentpos).Item("ESESI").ToString
TxtESPF.Text =
ds.Tables(0).Rows(currentpos).Item("ESPF").ToString
TxtESTotal.Text =
ds.Tables(0).Rows(currentpos).Item("ESTotal").ToString

BCA PROJECT
103

TxtESRemarks.Text =
ds.Tables(0).Rows(currentpos).Item("ESRemarks").ToString

End Sub

Private Sub BtnESNext_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESNext.Click
bnd.MoveNext()
currentpos = bnd.Position
calling()
End Sub

Private Sub BtnESPrevious_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESPrevious.Click
bnd.MovePrevious()
currentpos = bnd.Position
calling()
End Sub

Private Sub BtnESLast_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESLast.Click
bnd.MoveLast()
currentpos = bnd.Position

BCA PROJECT
104

calling()
End Sub

Private Sub BtnESEdit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnESEdit.Click

k = MsgBox("Update The Record...?",


MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()
cm.CommandText = "UPDATE EmpSal SET ESDate
='" + DtpESDate.Text + "',ESTime='" + TxtESTime.Text +
"',ESDay='" + TxtESDay.Text + "',ESEmpId='" +
TxtESEmpId.Text + "',ESEmpName='" + TxtESEmpName.Text +
"',ESDesig='" + TxtESDesig.Text + "',ESPMonth='" +
CmbESPMonth.Text + "',ESPDay='" + CmbESPDay.Text +
"',ESLeavemonth='" + CmbESLeavemonth.Text +
"',ESLMonthDay='" + CmbESLMonthDay.Text + "',ESBasicSal='" +
TxtESBasicSal.Text + "',ESAdvance='" + TxtESAdvance.Text +
"',ESDues='" + TxtESDues.Text + "',ESDA='" + TxtESDA.Text +
"',ESCCA='" + TxtESCCA.Text + "',ESESI='" + TxtESESI.Text +
"',ESPF='" + TxtESPF.Text + "',ESTotal='" + TxtESTotal.Text

BCA PROJECT
105

+ "',ESRemarks='" + TxtESRemarks.Text + "' WHERE ESSlNO='" +


TxtESSlNO.Text + "'"
Dim i As Integer = cm.ExecuteNonQuery
cn.Close()
MsgBox(i.ToString + " Record Updated")
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
DYNAMIC()
Else
DYNAMIC()
End If
End Sub

Private Sub TxtESTime_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TxtESTime.TextChanged

End Sub

Private Sub GroupBox1_Enter(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
GroupBox1.Enter

BCA PROJECT
106

End Sub

Private Sub DataGridView2_CellContentClick(ByVal sender


As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs)
Dim idx As Integer
idx = DataGridView1.SelectedCells(0).RowIndex
DtpESDate.Text =
DataGridView1.Rows(idx).Cells(0).Value.ToString
TxtESTime.Text =
DataGridView1.Rows(idx).Cells(1).Value.ToString
TxtESDay.Text =
DataGridView1.Rows(idx).Cells(2).Value.ToString
TxtESSlNO.Text =
DataGridView1.Rows(idx).Cells(3).Value.ToString
TxtESEmpId.Text =
DataGridView1.Rows(idx).Cells(4).Value.ToString
TxtESEmpName.Text =
DataGridView1.Rows(idx).Cells(5).Value.ToString
TxtESDesig.Text =
DataGridView1.Rows(idx).Cells(6).Value.ToString
CmbESPMonth.Text =
DataGridView1.Rows(idx).Cells(7).Value.ToString
CmbESPDay.Text =
DataGridView1.Rows(idx).Cells(8).Value.ToString

BCA PROJECT
107

CmbESLeavemonth.Text =
DataGridView1.Rows(idx).Cells(9).Value.ToString
CmbESLMonthDay.Text =
DataGridView1.Rows(idx).Cells(10).Value.ToString
TxtESBasicSal.Text =
DataGridView1.Rows(idx).Cells(11).Value.ToString
TxtESAdvance.Text =
DataGridView1.Rows(idx).Cells(12).Value.ToString
TxtESDues.Text =
DataGridView1.Rows(idx).Cells(13).Value.ToString
TxtESDA.Text =
DataGridView1.Rows(idx).Cells(14).Value.ToString
TxtESCCA.Text =
DataGridView1.Rows(idx).Cells(15).Value.ToString
TxtESESI.Text =
DataGridView1.Rows(idx).Cells(16).Value.ToString
TxtESPF.Text =
DataGridView1.Rows(idx).Cells(17).Value.ToString
TxtESTotal.Text =
DataGridView1.Rows(idx).Cells(18).Value.ToString
TxtESRemarks.Text =
DataGridView1.Rows(idx).Cells(19).Value.ToString

End Sub

BCA PROJECT
108

Private Sub TxtESEmpId_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESEmpId.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESEmpName.Focus()
End If

End Sub

Private Sub TxtESEmpName_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESEmpName.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESDesig.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESEmpId.Focus()
End If

End Sub

Private Sub TxtESDesig_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESDesig.KeyDown
If e.KeyCode = Keys.Enter Then
CmbESPMonth.Focus()
ElseIf e.KeyCode = Keys.Up Then

BCA PROJECT
109

TxtESEmpName.Focus()
End If

End Sub

Private Sub CmbESPMonth_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
CmbESPMonth.KeyDown
If e.KeyCode = Keys.Enter Then
CmbESPDay.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESDesig.Focus()
End If

End Sub

Private Sub CmbESPDay_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
CmbESPDay.KeyDown
If e.KeyCode = Keys.Enter Then
CmbESLeavemonth.Focus()
ElseIf e.KeyCode = Keys.Up Then
CmbESPMonth.Focus()
End If

End Sub

BCA PROJECT
110

Private Sub CmbESLeavemonth_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles CmbESLeavemonth.KeyDown
If e.KeyCode = Keys.Enter Then
CmbESLMonthDay.Focus()
ElseIf e.KeyCode = Keys.Up Then
CmbESPDay.Focus()
End If

End Sub

Private Sub CmbESLMonthDay_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles CmbESLMonthDay.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESBasicSal.Focus()
ElseIf e.KeyCode = Keys.Up Then
CmbESLeavemonth.Focus()
End If

End Sub

Private Sub TxtESBasicSal_KeyDown(ByVal sender As


Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles TxtESBasicSal.KeyDown

BCA PROJECT
111

If e.KeyCode = Keys.Enter Then


TxtESAdvance.Focus()
ElseIf e.KeyCode = Keys.Up Then
CmbESLMonthDay.Focus()
End If

End Sub

Private Sub TxtESAdvance_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESAdvance.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESDues.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESBasicSal.Focus()
End If

End Sub

Private Sub TxtESDues_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESDues.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESDA.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESAdvance.Focus()

BCA PROJECT
112

End If

End Sub

Private Sub TxtESDA_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESDA.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESCCA.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESDues.Focus()
End If

End Sub

Private Sub TxtESCCA_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESCCA.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESESI.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESDA.Focus()
End If

End Sub

BCA PROJECT
113

Private Sub TxtESESI_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESESI.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESPF.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESCCA.Focus()
End If

End Sub

Private Sub TxtESPF_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESPF.KeyDown
If e.KeyCode = Keys.Enter Then
TxtESTotal.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESESI.Focus()
End If

End Sub

Private Sub TxtESTotal_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESTotal.KeyDown
If e.KeyCode = Keys.Enter Then

BCA PROJECT
114

TxtESRemarks.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESPF.Focus()
End If

End Sub

Private Sub TxtESRemarks_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtESRemarks.KeyDown
If e.KeyCode = Keys.Enter Then
BtnESSave.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtESTotal.Focus()
End If

End Sub
Private Sub DataGridView2_CellContentClick_1(ByVal
sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView2.CellContentClick

End Sub

BCA PROJECT
115

Private Sub DataGridView2_DoubleClick(ByVal sender As


Object, ByVal e As System.EventArgs) Handles
DataGridView2.DoubleClick
Dim idx As Integer
idx = DataGridView2.SelectedCells(0).RowIndex
DtpESDate.Text =
DataGridView2.Rows(idx).Cells(0).Value.ToString
TxtESTime.Text =
DataGridView2.Rows(idx).Cells(1).Value.ToString
TxtESDay.Text =
DataGridView2.Rows(idx).Cells(2).Value.ToString
TxtESSlNO.Text =
DataGridView2.Rows(idx).Cells(3).Value.ToString
TxtESEmpId.Text =
DataGridView2.Rows(idx).Cells(4).Value.ToString
TxtESEmpName.Text =
DataGridView2.Rows(idx).Cells(5).Value.ToString
TxtESDesig.Text =
DataGridView2.Rows(idx).Cells(6).Value.ToString
CmbESPMonth.Text =
DataGridView2.Rows(idx).Cells(7).Value.ToString
CmbESPDay.Text =
DataGridView2.Rows(idx).Cells(8).Value.ToString
CmbESLeavemonth.Text =
DataGridView2.Rows(idx).Cells(9).Value.ToString

BCA PROJECT
116

CmbESLMonthDay.Text =
DataGridView2.Rows(idx).Cells(10).Value.ToString
TxtESBasicSal.Text =
DataGridView2.Rows(idx).Cells(11).Value.ToString
TxtESAdvance.Text =
DataGridView2.Rows(idx).Cells(12).Value.ToString
TxtESDues.Text =
DataGridView2.Rows(idx).Cells(13).Value.ToString
TxtESDA.Text =
DataGridView2.Rows(idx).Cells(14).Value.ToString
TxtESCCA.Text =
DataGridView2.Rows(idx).Cells(15).Value.ToString
TxtESESI.Text =
DataGridView2.Rows(idx).Cells(16).Value.ToString
TxtESPF.Text =
DataGridView2.Rows(idx).Cells(17).Value.ToString
TxtESTotal.Text =
DataGridView2.Rows(idx).Cells(18).Value.ToString
TxtESRemarks.Text =
DataGridView2.Rows(idx).Cells(19).Value.ToString

End Sub
End Class

BCA PROJECT
117

Product Master

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlException
Imports System.IO
Public Class FrmPrdMaster
Dim cn As New SqlConnection
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim cm As New SqlCommand
Dim dt As New DataTable
Dim rdr As SqlDataReader
Dim bnd As BindingSource = New BindingSource()
Dim cs As String
Dim p As Integer
Dim k As Integer
Dim currentpos As Integer = 0
Dim itemid As Integer = 0
Private Sub FrmPrdMaster_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
cs = "Server= localhost; Database=BOOTH;Integrated

Security=SSPI;"

cn = New SqlConnection(cs)

BCA PROJECT
118

cm = New SqlCommand(cs, cn)


da = New SqlDataAdapter("Select * from PrdMaster ", cs)
ds = New DataSet da.Fill(ds, " PrdMaster ")

clear()

Timer1.Enabled = True
Timer1.Interval = 1000
Dynamic()
AUTO()
End Sub

Private Sub BtnPMExit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnPMExit.Click
Me.Close()
End Sub

Sub clear()
TxtPMProName.Text = ""
TxtPMRemarks.Text = ""
AUTO()
End Sub
Sub Dynamic()
ds = New DataSet()

BCA PROJECT
119

da = New SqlDataAdapter("select * from PrdMaster",


cs)
da.Fill(ds, "PrdMaster")
bnd = New BindingSource()
bnd.DataMember = "PrdMaster"
bnd.DataSource = ds
DataGridView1.DataSource = bnd
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
TxtPMTime.Text = Date.Now.ToLongTimeString.ToString
TxtPMDay.Text = UCase(Date.Now.DayOfWeek.ToString())
End Sub
Sub AUTO()
cn.Open()
cm.CommandText = "select PMSlNo from PrdMaster"
rdr = cm.ExecuteReader()
While (rdr.Read())
p = Val(rdr("PMSlNo").ToString)
End While
cn.Close()
TxtPMSlNo.Text = p + 1
End Sub
Private Sub BtnPMDelete_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnPMDelete.Click

BCA PROJECT
120

k = MsgBox("DO YOU WANT TO DELETE THE SELECTED


OPTION", MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()
cm.CommandText = "DELETE * FROM PrdMaster
WHERE PMSlNo='" + TxtPMSlNo.Text + "'"
Dim i As Integer = cm.ExecuteNonQuery

If i = 0 Then
MsgBox("SELECTED RECORD NOT FOUND")

Exit Sub
End If
cn.Close()

MsgBox(i.ToString + " RECORD OF SELECTED


CATEGORY DELETED SUCCESSFULLY ")
clear()
TxtPMSlNo.Text = ""
TxtPMSlNo.Enabled = False
Catch ex As Exception

BCA PROJECT
121

MsgBox(ex.Message)
Finally
cn.Close()

End Try

Dynamic()
End If

End Sub
Private Sub BtnPMShow_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnPMShow.Click
If BtnPMShow.Text = "show" Then
DataGridView1.Visible = True
BtnPMShow.Text = "hide"
Else
BtnPMShow.Text = "show"
DataGridView1.Visible = False
BtnPMShow.Text = "show"
End If
Dynamic()

End Sub

BCA PROJECT
122

Private Sub BtnPMEdit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnPMEdit.Click
k = MsgBox("Update The Record...?",
MsgBoxStyle.YesNo)
If k = 6 Then

Try
cn.Open()
cm.CommandText = "UPDATE PrdMaster SET
PMDate='" + DtpPMDate.Text + "',PMTime='" + TxtPMTime.Text +
"',PMDay='" + TxtPMDay.Text + "',PMProName='" +
TxtPMProName.Text + "',PMRemarks='" + TxtPMRemarks.Text +
"'WHERE PMSlNo='" + TxtPMSlNo.Text + "' "
Dim i As Integer = cm.ExecuteNonQuery
cn.Close()
MsgBox(i.ToString + " Record Updated")
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
Dynamic()
Else
AUTO()
End If

BCA PROJECT
123

End Sub
Private Sub BtnPMSave_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnPMSave.Click

Try
cn.Open()

cm.CommandText = "Insert into


PrdMaster(PMDate,PMTime,PMDay,PMSlNo,PMProName,PMRemarks)
VALUES('" + DtpPMDate.Text + "','" + TxtPMTime.Text + "','"
+ TxtPMDay.Text + "','" + TxtPMSlNo.Text + "','" +
TxtPMProName.Text + "','" + TxtPMRemarks.Text + "')"

cm.ExecuteScalar()
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
Finally
cn.Close()
End Try
MsgBox("Record Saved ")
Dynamic()

BCA PROJECT
124

clear()

End Sub
Private Sub BtnPMCancel_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnPMCancel.Click
clear()

End Sub
Private Sub TxtPMProName_KeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtPMProName.KeyDown
If e.KeyCode = Keys.Enter Then
TxtPMRemarks.Focus()
End If

End Sub

Private Sub TxtPMRemarks_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtPMRemarks.KeyDown
If e.KeyCode = Keys.Enter Then
BtnPMSave.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtPMProName.Focus()
End If

BCA PROJECT
125

End Sub

Private Sub BtnESSearch_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESSearch.Click
Dim m As String = ""
Dim p As Integer = 0
TxtPMSlNo.Enabled = True
If TxtPMSlNo.Text = "" Then
MsgBox("PLEASE ENTER THE SLNO FOR SEARCHING ")
TxtPMSlNo.Focus()
Exit Sub
End If
cn.Open()
cm.CommandText = "select pmSLNO from PrdMaster"
rdr =
cm.ExecuteReader(CommandBehavior.SequentialAccess)
While (rdr.Read())
m = rdr("pmSLNO").ToString

If TxtPMSlNo.Text = m Then
p = p + 1
End If

End While
cn.Close()

BCA PROJECT
126

If p = 0 Then
MsgBox("GIVEN VALUE NOT FOUND")
clear()
TxtPMSlNo.Focus()
DataGridView1.Visible = False
Else
MsgBox("we found your data, press ok ")
BtnPMShow.Text = "Hidedata"
DataGridView1.Visible = True

ds = New DataSet()
da = New SqlDataAdapter("Select * From PrdMaster
where SLNO=" + TxtPMSlNo.Text + "", cs)
da.Fill(ds, "PrdMaster")
bnd = New BindingSource()
bnd.DataMember = "PrdMaster"
bnd.DataSource = ds

DataGridView1.DataSource = bnd
End If
End Sub

Private Sub BtnESFirst_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESFirst.Click
bnd.MoveFirst()

BCA PROJECT
127

currentpos = bnd.Position
callingA()
End Sub

Private Sub BtnESPrevious_Click(sender As System.Object,


e As System.EventArgs) Handles BtnESPrevious.Click
bnd.MovePrevious()
currentpos = bnd.Position
callingA()
End Sub
Sub callingA()

TxtPMSlNo.Text =
ds.Tables(0).Rows(currentpos).Item("PMSlNo").ToString
TxtPMProName.Text =
ds.Tables(0).Rows(currentpos).Item("PMProName").ToString
TxtPMRemarks.Text =
ds.Tables(0).Rows(currentpos).Item("PMRemarks").ToString
End Sub

Private Sub BtnESNext_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESNext.Click
bnd.MoveNext()
currentpos = bnd.Position
callingA()
End Sub

BCA PROJECT
128

Private Sub BtnESLast_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESLast.Click
bnd.MoveLast()
currentpos = bnd.Position
callingA()
End Sub

Private Sub DataGridView1_DoubleClick(sender As Object,


e As System.EventArgs) Handles DataGridView1.DoubleClick
Dim idx As Integer
idx = DataGridView1.SelectedCells(0).RowIndex
DtpPMDate.Text =
DataGridView1.Rows(idx).Cells(0).Value.ToString
TxtPMTime.Text =
DataGridView1.Rows(idx).Cells(1).Value.ToString
TxtPMDay.Text =
DataGridView1.Rows(idx).Cells(2).Value.ToString
TxtPMSlNo.Text =
DataGridView1.Rows(idx).Cells(3).Value.ToString
TxtPMProName.Text =
DataGridView1.Rows(idx).Cells(4).Value.ToString
TxtPMRemarks.Text =
DataGridView1.Rows(idx).Cells(5).Value.ToString

End Sub

BCA PROJECT
129

End Class

Product Type Master

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlException
Imports System.IO
Public Class FrmProTypeMaster

Dim cn As New SqlConnection


Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim cm As New SqlCommand
Dim dt As New DataTable
Dim rdr As SqlDataReader
Dim bnd As BindingSource = New BindingSource()
Dim cs As String
Dim p As Integer
Dim k As Integer
Dim currentpos As Integer = 0
Dim itemid As Integer = 0

BCA PROJECT
130

Private Sub FrmProTypeMaster_Load(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load

cs = "Server= localhost; Database=BOOTH;Integrated

Security=SSPI;"

cn = New SqlConnection(cs)
cm = New SqlCommand(cs, cn)
da = New SqlDataAdapter("Select * from ProTypeMaster ", cs)
ds = New DataSet da.Fill(ds, " ProTypeMaster ")

clear()

Timer1.Enabled = True
Timer1.Interval = 1000
dynamic()
AUTO()
End Sub
Private Sub BtnPTMExit_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnPTMExit.Click
Me.Close()
End Sub
Sub clear()
CmbPTMPName.Text = ""
TxtPTMPType.Text = ""

BCA PROJECT
131

TxtPTMRemarks.Text = ""

End Sub
Sub dynamic()
ds = New DataSet()
da = New SqlDataAdapter("select * from
ProTypeMaster", cs)
da.Fill(ds, "ProTypeMaster")
bnd = New BindingSource()
bnd.DataMember = "ProTypeMaster"
bnd.DataSource = ds
DataGridView1.DataSource = bnd

End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
TxtPTMTime.Text = Date.Now.ToLongTimeString.ToString
TxtPTMDay.Text =
UCase(Date.Now.DayOfWeek.ToString())

End Sub
Sub AUTO()

cn.Open()
cm.CommandText = "select PTMSlNo from ProTypeMaster"
rdr = cm.ExecuteReader()

BCA PROJECT
132

While (rdr.Read())
p = Val(rdr("PTMSlNo").ToString)
End While
cn.Close()
TxtPTMSlNo.Text = p + 1

End Sub
Private Sub BtnPTMCancel_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BtnPTMCancel.Click
clear()
End Sub

Private Sub BtnPTMDelete_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnPTMDelete.Click
k = MsgBox("DO YOU WANT TO DELETE THE SELECTED
OPTION", MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()
cm.CommandText = "DELETE * FROM
ProTypeMaster WHERE PTMSlNo='" + TxtPTMSlNo.Text + "' "
Dim i As Integer = cm.ExecuteNonQuery

BCA PROJECT
133

If i = 0 Then
MsgBox("SELECTED RECORD NOT FOUND")

Exit Sub
End If
cn.Close()

MsgBox(i.ToString + " RECORD OF SELECTED


CATEGORY DELETED SUCCESSFULLY ")
clear()
TxtPTMSlNo.Text = ""
TxtPTMSlNo.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()

End Try

dynamic()
End If

End Sub

BCA PROJECT
134

Private Sub BtnPTM_Show_Click(ByVal Sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnPTMShow.Click
If BtnPTMShow.Text = "show" Then
DataGridView1.Visible = True
BtnPTMShow.Text = "hide"
Else
BtnPTMShow.Text = "show"
DataGridView1.Visible = False
End If
dynamic()

End Sub

Private Sub BtnPTMEdit_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnPTMEdit.Click
k = MsgBox("Update The Record...?",
MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()

BCA PROJECT
135

cm.CommandText = "UPDATE ProTypeMaster SET


PTMDate ='" + DtpPTMDate.Text + "',PTMTime ='" +
TxtPTMTime.Text + "',PTMDay='" + TxtPTMDay.Text + "',
PTMPName ='" + CmbPTMPName.Text + "',PTMPType='" +
TxtPTMPType.Text + "',PTMRemarks='" + TxtPTMRemarks.Text +
"'WHERE PTMSlNo='" + TxtPTMSlNo.Text + "' "
Dim i As Integer = cm.ExecuteNonQuery
cn.Close()
MsgBox(i.ToString + " Record Updated")
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
dynamic()
Else
AUTO()
End If

End Sub

Private Sub BtnPTMSave_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtnPTMSave.Click
Try
cn.Open()

BCA PROJECT
136

cm.CommandText = "Insert into


ProTypeMaster(PTMDate,PTMTime,PTMDay,PTMSlNo,PTMPName,PTMPTy
pe,PTMRemarks) VALUES('" + DtpPTMDate.Text + "','" +
TxtPTMTime.Text + "','" + TxtPTMDay.Text + "','" +
TxtPTMSlNo.Text + "','" + CmbPTMPName.Text + "','" +
TxtPTMPType.Text + "','" + TxtPTMRemarks.Text + "')"

cm.ExecuteScalar()
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
Finally
cn.Close()
End Try
MsgBox("Record Saved ")

dynamic()
clear()
AUTO()
End Sub

BCA PROJECT
137

Private Sub CmbPTMPName__KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
CmbPTMPName.KeyDown
If e.KeyCode = Keys.Enter Then
TxtPTMPType.Focus()
End If
End Sub
Private Sub TxtPTMPType__KeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtPTMPType.KeyDown
If e.KeyCode = Keys.Enter Then
TxtPTMRemarks.Focus()
ElseIf e.KeyCode = Keys.Up Then
CmbPTMPName.Focus()
End If
End Sub
Private Sub TxtPTMRemarks__KeyDown(ByVal sender As
Object, ByVal e As System.Windows.Forms.KeyEventArgs)
Handles TxtPTMRemarks.KeyDown
If e.KeyCode = Keys.Enter Then
BtnPTMSave.Focus()
ElseIf e.KeyCode = Keys.Up Then
TxtPTMPType.Focus()
End If
End Sub

BCA PROJECT
138

Private Sub BtnESSearch_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESSearch.Click
Dim m As String = ""
Dim p As Integer = 0
TxtPTMSlNo.Enabled = True
If TxtPTMSlNo.Text = "" Then
MsgBox("PLEASE ENTER THE PTMSlNo FOR SEARCHING
")
TxtPTMSlNo.Focus()
Exit Sub
End If
cn.Open()
cm.CommandText = "select PTMSlNo from ProTypeMaster"
rdr =
cm.ExecuteReader(CommandBehavior.SequentialAccess)
While (rdr.Read())
m = rdr("PTMSlNo").ToString

If TxtPTMSlNo.Text = m Then
p = p + 1
End If

End While
cn.Close()

If p = 0 Then

BCA PROJECT
139

MsgBox("GIVEN VALUE NOT FOUND")


clear()
TxtPTMSlNo.Focus()
DataGridView1.Visible = False
Else
MsgBox("we found your data, press ok ")
BtnPTMShow.Text = "Hidedata"
DataGridView1.Visible = True

ds = New DataSet()
da = New SqlDataAdapter("Select * From
ProTypeMaster where PTMSlNo=" + TxtPTMSlNo.Text + "", cs)
da.Fill(ds, "ProTypeMaster")
bnd = New BindingSource()
bnd.DataMember = "ProTypeMaster"
bnd.DataSource = ds

DataGridView1.DataSource = bnd
End If
End Sub

Private Sub BtnESFirst_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESFirst.Click
bnd.MoveFirst()
currentpos = bnd.Position
callingA()

BCA PROJECT
140

End Sub
Sub callingA()

TxtPTMSlNo.Text =
ds.Tables(0).Rows(currentpos).Item("ptmslno").ToString
CmbPTMPName.Text =
ds.Tables(0).Rows(currentpos).Item("PTMPName").ToString
TxtPTMPType.Text =
ds.Tables(0).Rows(currentpos).Item("PTMPType").ToString
TxtPTMRemarks.Text =
ds.Tables(0).Rows(currentpos).Item("PTMRemarks").ToString

End Sub

Private Sub BtnESNext_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESNext.Click
bnd.MoveNext()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BtnESPrevious_Click(sender As System.Object,


e As System.EventArgs) Handles BtnESPrevious.Click
bnd.MovePrevious()
currentpos = bnd.Position

BCA PROJECT
141

callingA()
End Sub

Private Sub BtnESLast_Click(sender As System.Object, e


As System.EventArgs) Handles BtnESLast.Click
bnd.MoveLast()
currentpos = bnd.Position
callingA()
End Sub
Private Sub DataGridView1_DoubleClick(sender As Object,
e As System.EventArgs) Handles DataGridView1.DoubleClick
Dim idx As Integer
idx = DataGridView1.SelectedCells(0).RowIndex
DtpPTMDate.Text =
DataGridView1.Rows(idx).Cells(0).Value.ToString
TxtPTMTime.Text =
DataGridView1.Rows(idx).Cells(1).Value.ToString
TxtPTMDay.Text =
DataGridView1.Rows(idx).Cells(2).Value.ToString
TxtPTMSlNo.Text =
DataGridView1.Rows(idx).Cells(3).Value.ToString
CmbPTMPName.Text =
DataGridView1.Rows(idx).Cells(4).Value.ToString
TxtPTMPType.Text =
DataGridView1.Rows(idx).Cells(5).Value.ToString

BCA PROJECT
142

TxtPTMRemarks.Text =
DataGridView1.Rows(idx).Cells(6).Value.ToString
End Sub
End Class

EXPENSE ENTRY

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlException
Imports System.IO
Public Class FrmExpGD
Dim cn As New SqlConnection
Dim da As New SqlDataAdapter
Dim ds As New DataSet
Dim cm As New SqlCommand
Dim dt As New DataTable
Dim rdr As SqlDataReader
Dim bnd As BindingSource = New BindingSource()
Dim cs As String
Dim p As Integer
Dim k As Integer
Dim currentpos As Integer = 0

BCA PROJECT
143

Dim itemid As Integer = 0


Dim i As Integer

Private Sub FrmExpGD_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles MyBase.Load

cs = "Server= localhost; Database=BOOTH;Integrated

Security=SSPI;"

cn = New SqlConnection(cs)
cm = New SqlCommand(cs, cn)
da = New SqlDataAdapter("Select * from PurAccount ", cs)
ds = New DataSet da.Fill(ds, " PurAccount ")

DataGridView1.Visible = False
Timer1.Enabled = True
Timer1.Interval = 1000
auto()
Dynamic()
clear()
com()
End Sub
Sub auto()

cn.Open()
cm.CommandText = "select Slen from ExpEntry"
rdr = cm.ExecuteReader()

BCA PROJECT
144

While (rdr.Read())
p = rdr("Slen").ToString
End While
cn.Close()
TxtSlEN.Text = p + 1

End Sub
Sub dynamic()

ds = New DataSet()
da = New SqlDataAdapter("Select * From ExpEntry ",
cs)
da.Fill(ds, "ExpEntry ")
bnd = New BindingSource()
bnd.DataMember = "ExpEntry "
bnd.DataSource = ds
DataGridView1.DataSource = bnd

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles Timer1.Tick
DtpTimEN.Text = Date.Now.ToLongTimeString.ToString
TxtDayEN.Text = UCase(Date.Now.DayOfWeek.ToString())
End Sub
Sub clear()

BCA PROJECT
145

CmbTExpEN.Text = ""
CmbExpBEN.Text = ""
TxtExpFEN.Text = "N/A"
TxtExpOEN.Text = "N/A"
TxtMetEN.Text = "N/A"
TxtQtyEN.Text = "00"
TxtRatEN.Text = "00"
TxtTotEN.Text = "00"
TxtSopNEN.Text = "N/A"
TxtGTotEN.Text = "00"
TxtPAdvEN.Text = "00"
TxtAdvEN.Text = "00"
TxtPadEN.Text = "00"
TxtPDueEN.Text = "00"
TxtRmkEN.Text = "N/A"
TxtSopIDEN.Text = "N/A"
TxtDueEN.Text = "00"
TxtNPayEN.Text = "00"
ListView2.Items.Clear()
com()
TxtTotEN.Enabled = False
TxtGTotEN.Enabled = False
TxtPAdvEN.Enabled = False
TxtAdvEN.Enabled = False
TxtPDueEN.Enabled = False
TxtDueEN.Enabled = False

BCA PROJECT
146

TxtNPayEN.Enabled = False
End Sub

Private Sub BtmExtEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmExtEN.Click
Me.Close()
End Sub

Private Sub BtmCenlEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmCenlEN.Click
clear()
End Sub

Private Sub BtmShoEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmShoEN.Click
If BtmShoEN.Text = "Show Data" Then
DataGridView1.Visible = True
BtmShoEN.Text = "Hidedata"
Else
BtmShoEN.Text = "Hidedata"
DataGridView1.Visible = False
BtmShoEN.Text = "Show Data"
End If

BCA PROJECT
147

dynamic()
End Sub

Private Sub BtmDltEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmDltEN.Click

k = MsgBox("DO YOU WANT TO DELETE OPTION ",


MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()

cm.CommandText = "DELETE * FROM ExpEntry


WHERE SlEN=" + TxtSlEN.Text + " "
Dim i As Integer = cm.ExecuteNonQuery

If i = 0 Then
MsgBox("SELECTED RECORD NOT FOUND")

Exit Sub
End If

BCA PROJECT
148

cn.Close()

MsgBox(i.ToString + " RECORD OF SELECTED


CATEGORY DELETED SUCCESSFULLY ")
'clear()
'TxtSlEN.Text = ""
'TxtSlEN.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()

End Try

dynamic()
End If
End Sub

Private Sub BtmSerchEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmSerchEN.Click
Dim m As String = ""
Dim p As Integer = 0
TxtSlEN.Enabled = True
If TxtSlEN.Text = "" Then
MsgBox("PLEASE ENTER THE SL NO. FOR SEARCHING ")

BCA PROJECT
149

TxtSlEN.Focus()
Exit Sub
End If
cn.Open()
cm.CommandText = "select SlEN from ExpEntry"
rdr =
cm.ExecuteReader(CommandBehavior.SequentialAccess)
While (rdr.Read())
m = rdr("SlEN").ToString

If TxtSlEN.Text = m Then
p = p + 1
End If

End While
cn.Close()

If p = 0 Then
MsgBox("GIVEN VALUE NOT FOUND")
clear()
TxtSlEN.Focus()
DataGridView1.Visible = False
Else
MsgBox("GIVEN VALUE ALREADY PRESENT ")
BtmShoEN.Text = "HIDEDATA"
DataGridView1.Visible = True

BCA PROJECT
150

ds = New DataSet()
da = New SqlDataAdapter("Select * From ExpEntry
where SlEN=" + TxtSlEN.Text + "", cs)
da.Fill(ds, "ExpEntry")
bnd = New BindingSource()
bnd.DataMember = "ExpEntry"
bnd.DataSource = ds

DataGridView1.DataSource = bnd
End If
End Sub
Sub callingA()

DtpTimEN.Text =
ds.Tables(0).Rows(currentpos).Item("TimEN").ToString
TxtDayEN.Text =
ds.Tables(0).Rows(currentpos).Item("DayEN").ToString
TxtSlEN.Text =
ds.Tables(0).Rows(currentpos).Item("SlEN").ToString
CmbTExpEN.Text =
ds.Tables(0).Rows(currentpos).Item("TExpEN").ToString
CmbExpBEN.Text =
ds.Tables(0).Rows(currentpos).Item("ExpBEN").ToString
TxtExpFEN.Text =
ds.Tables(0).Rows(currentpos).Item("ExpFEN").ToString

BCA PROJECT
151

TxtExpOEN.Text =
ds.Tables(0).Rows(currentpos).Item("ExpOEN").ToString
TxtMetEN.Text =
ds.Tables(0).Rows(currentpos).Item("MetEN").ToString
TxtQtyEN.Text =
ds.Tables(0).Rows(currentpos).Item("QtyEN").ToString
TxtRatEN.Text =
ds.Tables(0).Rows(currentpos).Item("RatEN").ToString
TxtTotEN.Text =
ds.Tables(0).Rows(currentpos).Item("TotEN").ToString
TxtSopNEN.Text =
ds.Tables(0).Rows(currentpos).Item("SopNEN").ToString
TxtGTotEN.Text =
ds.Tables(0).Rows(currentpos).Item("GTotEN").ToString
TxtPAdvEN.Text =
ds.Tables(0).Rows(currentpos).Item("PAdvEN").ToString
TxtAdvEN.Text =
ds.Tables(0).Rows(currentpos).Item("AdvEN").ToString
TxtPadEN.Text =
ds.Tables(0).Rows(currentpos).Item("PadEN").ToString
TxtPDueEN.Text =
ds.Tables(0).Rows(currentpos).Item("DueEN").ToString
TxtRmkEN.Text =
ds.Tables(0).Rows(currentpos).Item("RmkEN").ToString
TxtSopIDEN.Text =
ds.Tables(0).Rows(currentpos).Item("sopiden").ToString

BCA PROJECT
152

TxtPDueEN.Text =
ds.Tables(0).Rows(currentpos).Item("PDueEN").ToString
TxtNPayEN.Text =
ds.Tables(0).Rows(currentpos).Item("npayen").ToString
End Sub

Private Sub BtmFstEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmFstEN.Click
If DataGridView1.RowCount <= 1 Then
MsgBox("Value is not present")
Exit Sub
End If

bnd.MoveFirst()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BtmNxtEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmNxtEN.Click

If DataGridView1.RowCount <= 1 Then


MsgBox("Value is not present")

BCA PROJECT
153

Exit Sub
End If
bnd.MoveNext()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BtmLstEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmLstEN.Click
If DataGridView1.RowCount <= 1 Then
MsgBox("Value is not present")
Exit Sub
End If

bnd.MoveLast()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BtmPrivsEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmPrivsEN.Click
If DataGridView1.RowCount <= 1 Then
MsgBox("Value is not present")
Exit Sub

BCA PROJECT
154

End If

bnd.MovePrevious()
currentpos = bnd.Position
callingA()
End Sub

Private Sub BtmSavEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmSavEN.Click
If CmbTExpEN.Text = "" Then
MsgBox("Enter Expense Type ")
CmbTExpEN.Focus()
Exit Sub
ElseIf CmbExpBEN.Text = "" Then
MsgBox("Enter Expense By")
CmbExpBEN.Focus()
Exit Sub
ElseIf TxtExpOEN.Text = "" Then
MsgBox("Enter Expense On")
TxtExpOEN.Focus()
Exit Sub
ElseIf TxtExpFEN.Text = "" Then
MsgBox("Enter Expense For")
TxtExpFEN.Focus()
Exit Sub

BCA PROJECT
155

ElseIf TxtMetEN.Text = "" Then


MsgBox("Enter Meterial Name")
TxtMetEN.Focus()
Exit Sub
ElseIf TxtQtyEN.Text = "" Then
MsgBox("Enter Quntity")
TxtQtyEN.Focus()
Exit Sub
ElseIf TxtRatEN.Text = "" Then
MsgBox("Enter Rate")
TxtRatEN.Focus()
Exit Sub
ElseIf TxtSopNEN.Text = "" Then
MsgBox("Enter Sope Name")
TxtSopNEN.Focus()
Exit Sub
ElseIf TxtPadEN.Text = "" Then
MsgBox("Enter Paid Amount")
TxtPadEN.Focus()
Exit Sub
End If

Dim itemid As Integer


itemid = ListView2.Items.Count
If itemid = 0 Then
MsgBox("Enter The List View Data")

BCA PROJECT
156

TxtSopNEN.Focus()
Exit Sub
End If

For i As Integer = 0 To ListView2.Items.Count - 1


With ListView2.Items(i)

Try
cn.Open()
cm.CommandText = "Insert into
ExpEntry(slen,daten,timen,dayen,texpen,expben,expfen,expoen,
INden,meten,qtyen,raten,toten,sopiden,sopnen,gtoten,padven,a
dven,npayen,paden,pdueen,dueen,rmken)VALUES (" +
TxtSlEN.Text + ",'" +

Me.DtpDatEN.Value.Date.ToShortDateString.ToString + "','" +
DtpTimEN.Text + "','" +
TxtDayEN.Text + "','" +
CmbTExpEN.Text + "','" +
CmbExpBEN.Text + "','" +
TxtExpFEN.Text + "','" +
TxtExpOEN.Text + "','" +
.SubItems(0).Text + "','" +
.SubItems(1).Text + "'," +

BCA PROJECT
157

.SubItems(2).Text + "," +
.SubItems(3).Text + "," +
.SubItems(4).Text + ",'" +
.SubItems(5).Text + "','" +
.SubItems(6).Text + "'," +
TxtGTotEN.Text + "," +
TxtPAdvEN.Text + "," +
TxtAdvEN.Text + "," +
TxtNPayEN.Text + "," +
TxtPadEN.Text + "," +
TxtPDueEN.Text + "," +
TxtDueEN.Text + ",'" +
TxtRmkEN.Text + "')"

cm.ExecuteScalar()
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
Finally
cn.Close()
End Try

End With
Next
MsgBox("Record Saved")
dynamic()

BCA PROJECT
158

clear()
auto()
End Sub

Private Sub BtmEdtEN_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
BtmEdtEN.Click
If CmbTExpEN.Text = "" Then
MsgBox("Enter Expense Type ")
CmbTExpEN.Focus()
Exit Sub
ElseIf CmbExpBEN.Text = "" Then
MsgBox("Enter Expense By")
CmbExpBEN.Focus()
Exit Sub
ElseIf TxtExpOEN.Text = "" Then
MsgBox("Enter Expense On")
TxtExpOEN.Focus()
Exit Sub
ElseIf TxtExpFEN.Text = "" Then
MsgBox("Enter Expense For")
TxtExpFEN.Focus()
Exit Sub
ElseIf TxtMetEN.Text = "" Then
MsgBox("Enter Meterial Name")
TxtMetEN.Focus()

BCA PROJECT
159

Exit Sub
ElseIf TxtQtyEN.Text = "" Then
MsgBox("Enter Quntity")
TxtQtyEN.Focus()
Exit Sub
ElseIf TxtRatEN.Text = "" Then
MsgBox("Enter Rate")
TxtRatEN.Focus()
Exit Sub
ElseIf TxtSopNEN.Text = "" Then
MsgBox("Enter Sope Name")
TxtSopNEN.Focus()
Exit Sub
ElseIf TxtPadEN.Text = "" Then
MsgBox("Enter Paid Amount")
TxtPadEN.Focus()
Exit Sub
End If

k = MsgBox("Update The Record...?",


MsgBoxStyle.YesNo)

If k = 6 Then

Try
cn.Open()

BCA PROJECT
160

cm.CommandText = "UPDATE ExpEntry SET Daten


='" + Me.DtpDatEN.Value.Date.ToShortDateString.ToString +
"',Timen ='" + DtpTimEN.Text + "',Dayen ='" + TxtDayEN.Text
+ "',texpen ='" + CmbTExpEN.Text + "',expben='" +
CmbExpBEN.Text + "',expfen ='" + TxtExpFEN.Text + "',expoen
='" + TxtExpOEN.Text + "',meten ='" + TxtMetEN.Text +
"',qtyen ='" + TxtQtyEN.Text + "',raten='" + TxtRatEN.Text +
"', toten='" + TxtTotEN.Text + "',sopisen='" +
txtsopiden.Text + "',sopnen= '" + TxtSopNEN.Text +
"',GtotEn='" + TxtGTotEN.Text + "',Padven='" +
TxtPAdvEN.Text + "',adven= '" + TxtGTotEN.Text +
"',npayen='" + TxtNPayEN.Text + "',paden= '" + TxtPadEN.Text
+ "',pdueen='" + TxtPDueEN.Text + "',dueen= '" +
TxtPDueEN.Text + "',rmken= '" + TxtRmkEN.Text + "' WHERE
slen = " + TxtSlEN.Text + ""
Dim i As Integer = cm.ExecuteNonQuery
cn.Close()
MsgBox(i.ToString + " Record Updated")
'calling()
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
clear()
dynamic()

BCA PROJECT
161

Else
clear()
dynamic()
End If
End Sub

Private Sub DataGridView1_DoubleClick(ByVal sender As


Object, ByVal e As System.EventArgs) Handles
DataGridView1.DoubleClick
Dim idx As Integer
idx = DataGridView1.SelectedCells(0).RowIndex
DtpDatEN.Text =
DataGridView1.Rows(idx).Cells(0).Value.ToString
DtpTimEN.Text =
DataGridView1.Rows(idx).Cells(1).Value.ToString
TxtDayEN.Text =
DataGridView1.Rows(idx).Cells(2).Value.ToString
TxtSlEN.Text =
DataGridView1.Rows(idx).Cells(3).Value.ToString
CmbTExpEN.Text =
DataGridView1.Rows(idx).Cells(4).Value.ToString
CmbExpBEN.Text =
DataGridView1.Rows(idx).Cells(5).Value.ToString
TxtExpOEN.Text =
DataGridView1.Rows(idx).Cells(6).Value.ToString

BCA PROJECT
162

TxtExpFEN.Text =
DataGridView1.Rows(idx).Cells(7).Value.ToString
TxtMetEN.Text =
DataGridView1.Rows(idx).Cells(9).Value.ToString
TxtQtyEN.Text =
DataGridView1.Rows(idx).Cells(10).Value.ToString
TxtRatEN.Text =
DataGridView1.Rows(idx).Cells(11).Value.ToString
TxtTotEN.Text =
DataGridView1.Rows(idx).Cells(12).Value.ToString
TxtSopIDEN.Text =
DataGridView1.Rows(idx).Cells(13).Value.ToString
TxtSopNEN.Text =
DataGridView1.Rows(idx).Cells(14).Value.ToString
TxtGTotEN.Text =
DataGridView1.Rows(idx).Cells(15).Value.ToString
TxtPDueEN.Text =
DataGridView1.Rows(idx).Cells(16).Value.ToString
TxtPAdvEN.Text =
DataGridView1.Rows(idx).Cells(17).Value.ToString
TxtNPayEN.Text =
DataGridView1.Rows(idx).Cells(18).Value.ToString
TxtPadEN.Text =
DataGridView1.Rows(idx).Cells(19).Value.ToString
TxtDueEN.Text =
DataGridView1.Rows(idx).Cells(20).Value.ToString

BCA PROJECT
163

TxtAdvEN.Text =
DataGridView1.Rows(idx).Cells(21).Value.ToString
TxtRmkEN.Text =
DataGridView1.Rows(idx).Cells(22).Value.ToString

End Sub

Private Sub CmbTExpEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
CmbTExpEN.KeyDown
If e.KeyCode = Keys.Enter Then
CmbExpBEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
CmbTExpEN.Text = ""

End If
End Sub

Private Sub CmbExpBEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
CmbExpBEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtExpOEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
CmbExpBEN.Text = ""

BCA PROJECT
164

End If
End Sub

Private Sub TxtExpOEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtExpOEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtExpFEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtExpOEN.Text = ""

ElseIf e.KeyCode = Keys.Up Then


CmbTExpEN.Focus()
ElseIf e.KeyCode = Keys.Down Then
TxtMetEN.Focus()
End If
End Sub

Private Sub TxtExpFEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtExpFEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtMetEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtExpFEN.Text = ""

BCA PROJECT
165

ElseIf e.KeyCode = Keys.Up Then


CmbExpBEN.Focus()
ElseIf e.KeyCode = Keys.Down Then
TxtSopNEN.Focus()
End If
End Sub

Private Sub TxtMetEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtMetEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtQtyEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtMetEN.Text = ""

ElseIf e.KeyCode = Keys.Up Then


TxtExpOEN.Focus()

End If
End Sub

Private Sub TxtQtyEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtQtyEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtRatEN.Focus()

BCA PROJECT
166

ElseIf e.KeyCode = Keys.Escape Then


TxtQtyEN.Text = ""

ElseIf e.KeyCode = Keys.Up Then


TxtExpOEN.Focus()

End If
End Sub

Private Sub TxtRatEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtRatEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtTotEN.Text = Val(TxtQtyEN.Text) *
Val(TxtRatEN.Text)
TxtTotEN.Enabled = False
txtsopiden.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtRatEN.Text = ""

ElseIf e.KeyCode = Keys.Up Then


TxtExpOEN.Focus()

End If
End Sub

BCA PROJECT
167

Private Sub TxtTotEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtTotEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtSopNEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtTotEN.Text = ""

ElseIf e.KeyCode = Keys.Up Then


TxtExpOEN.Focus()

End If
End Sub

Private Sub TxtSopNEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtSopNEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtGTotEN.Text = Val(TxtGTotEN.Text) +
Val(TxtTotEN.Text)
If Val(Val(TxtGTotEN.Text) +
Val(TxtPDueEN.Text)) > Val(TxtPAdvEN.Text) Then
TxtNPayEN.Text = Val(Val(Val(TxtGTotEN.Text)
+ Val(TxtPDueEN.Text)) - Val(TxtPAdvEN.Text))
TxtAdvEN.Text = "00"
Else

BCA PROJECT
168

TxtAdvEN.Text = Val(Val(TxtPAdvEN.Text) -
Val(TxtGTotEN.Text) + Val(TxtPDueEN.Text))
TxtNPayEN.Text = "00"
End If

TxtGTotEN.Enabled = False
itemid = ListView2.Items.Count

ListView2.Items.Add(itemid + 1)

ListView2.Items(itemid).SubItems.Add(TxtMetEN.Text)

ListView2.Items(itemid).SubItems.Add(TxtQtyEN.Text)

ListView2.Items(itemid).SubItems.Add(TxtRatEN.Text)

ListView2.Items(itemid).SubItems.Add(TxtTotEN.Text)

ListView2.Items(itemid).SubItems.Add(TxtSopIDEN.Text)

ListView2.Items(itemid).SubItems.Add(TxtSopNEN.Text)
itemid += 1
TxtMetEN.Text = "N/A"
TxtQtyEN.Text = "00"
TxtRatEN.Text = "00"
TxtTotEN.Text = "00"
TxtSopIDEN.Text = "N/A"

BCA PROJECT
169

TxtSopNEN.Text = "N/A"
TxtMetEN.Focus()

ElseIf e.KeyCode = Keys.Escape Then


TxtSopNEN.Text = ""

ElseIf e.KeyCode = Keys.Up Then


TxtExpFEN.Focus()

End If
End Sub

Private Sub TxtGtotEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtGTotEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtPAdvEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtGTotEN.Text = ""

End If
End Sub

Private Sub TxtPadEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtPadEN.KeyDown

BCA PROJECT
170

If e.KeyCode = Keys.Enter Then


ac()
TxtDueEN.Enabled = False
TxtRmkEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtPadEN.Text = ""

End If
End Sub

Private Sub TxtDueEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtPDueEN.KeyDown, TxtDueEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtRmkEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtPDueEN.Text = ""

End If
End Sub

Private Sub TxtRmkEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtRmkEN.KeyDown
If e.KeyCode = Keys.Enter Then
BtmSavEN.Focus()

BCA PROJECT
171

ElseIf e.KeyCode = Keys.Escape Then


TxtRmkEN.Text = ""
End If
End Sub

Private Sub TxtQtyEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtQtyEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub

Private Sub TxtRatEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtRatEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then

BCA PROJECT
172

e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub

Private Sub TxtTotEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtTotEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub

BCA PROJECT
173

Private Sub TxtAdvEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtGTotEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub

Private Sub TxtPadEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtPadEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

BCA PROJECT
174

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub

Private Sub TxtDueEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtPDueEN.KeyPress, TxtDueEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub
Sub com()
CmbTExpEN.Items.Clear()
CmbExpBEN.Items.Clear()
Try
cn.Open()

BCA PROJECT
175

cm.CommandText = "SELECT distinct texpen,expben


FROM expentry "
rdr = cm.ExecuteReader()
While (rdr.Read())
CmbTExpEN.Items.Add(rdr("texpen").ToString)
CmbExpBEN.Items.Add(rdr("expben").ToString)
End While
Catch ex As Exception
MsgBox(ex.Message.ToString)
Finally
cn.Close()
End Try

Try
cn.Open()

cm.CommandText = "SELECT distinct sopidsd FROM


sopdetail "
rdr = cm.ExecuteReader()
While (rdr.Read())

txtsopiden.Items.Add(rdr("sopidsd").ToString)
End While
Catch ex As Exception
MsgBox(ex.Message.ToString)
Finally

BCA PROJECT
176

cn.Close()
End Try
End Sub

Private Sub ListView2_DoubleClick(ByVal sender As


Object, ByVal e As System.EventArgs) Handles
ListView2.DoubleClick
Dim SelectedItemInList As New ListViewItem

SelectedItemInList = ListView2.SelectedItems(0)
TxtMetEN.Text = SelectedItemInList.SubItems(1).Text
TxtQtyEN.Text = SelectedItemInList.SubItems(2).Text
TxtRatEN.Text = SelectedItemInList.SubItems(3).Text
TxtTotEN.Text = SelectedItemInList.SubItems(4).Text
TxtSopNEN.Text = SelectedItemInList.SubItems(5).Text
SelectedItemInList.Remove()
End Sub

Private Sub ListView2_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ListView2.KeyDown
If e.KeyCode = Keys.Delete Then
Dim SelectedItemInList As New ListViewItem
SelectedItemInList = ListView2.SelectedItems(0)
SelectedItemInList.Remove()

BCA PROJECT
177

For i As Integer = 0 To ListView2.Items.Count -


1
ListView2.Items(i).Text = (i + 1)
Next

End If
End Sub

Private Sub TxtPAdvEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtPAdvEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtAdvEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtPAdvEN.Text = ""
End If
End Sub

Private Sub TxtAdvEN_KeyDown(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyEventArgs) Handles
TxtAdvEN.KeyDown, TxtNPayEN.KeyDown
If e.KeyCode = Keys.Enter Then
TxtPadEN.Focus()
ElseIf e.KeyCode = Keys.Escape Then
TxtAdvEN.Text = ""
End If

BCA PROJECT
178

End Sub

Private Sub TxtAdvEN_KeyPress1(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtAdvEN.KeyPress, TxtNPayEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True
Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub

Private Sub TxtPAdvEN_KeyPress(ByVal sender As Object,


ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TxtPAdvEN.KeyPress
If Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or
e.KeyChar = ".") Then
e.Handled = True
If (Asc(e.KeyChar) = 13) Then
e.Handled = True

BCA PROJECT
179

Return
End If

MsgBox("ENTER ONLY NUMERIC VALUE")


Exit Sub
End If
End Sub
Sub ac()
If Val(TxtNPayEN.Text) >= Val(TxtPadEN.Text) Then
TxtDueEN.Text = Val(Val(TxtNPayEN.Text) -
Val(TxtPadEN.Text))
TxtAdvEN.Text = "00"
Else
TxtAdvEN.Text = Val(Val(TxtPadEN.Text) -
Val(TxtNPayEN.Text))
TxtDueEN.Text = "00"
End If
End Sub
Private Sub txtsopiden_KeyDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
txtsopiden.KeyDown
If e.KeyCode = Keys.Enter Then
Try
cn.Open()

BCA PROJECT
180

cm.CommandText = "SELECT distinct


adven,dueen FROM expentry where sopiden='" + txtsopiden.Text
+ "'"
rdr = cm.ExecuteReader()
While (rdr.Read())
TxtPAdvEN.Text = (rdr("adven").ToString)
TxtPDueEN.Text = (rdr("dueen").ToString)
End While
Catch ex As Exception
MsgBox(ex.Message.ToString)
Finally
cn.Close()
End Try

TxtSopNEN.Focus()
End If
End Sub

Private Sub txtsopiden_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles txtsopiden.SelectedIndexChanged
Try
cn.Open()

cm.CommandText = "SELECT distinct sopnsd FROM


sopdetail where sopidsd='" + txtsopiden.Text + "'"

BCA PROJECT
181

rdr = cm.ExecuteReader()
While (rdr.Read())
TxtSopNEN.Text = (rdr("sopnsd").ToString)

End While
Catch ex As Exception
MsgBox(ex.Message.ToString)
Finally
cn.Close()
End Try

End Sub

Private Sub BtmPrintEN_Click(sender As System.Object, e


As System.EventArgs) Handles BtmPrintEN.Click
FExpESE.Show()
End Sub
End Class

Private Sub BtmPrintDD_Click(sender As System.Object,


e As System.EventArgs) Handles BtmPrintDD.Click
FDelMan.Show()
End Sub
End Class

BCA PROJECT
182

SYSTEM TESTING IMPLEMENTATION & MAINTENANCE

SYSTEM TESTING :-

One of the most important function before actual implementation of system

is its testing. Testing is a set of activities that can be planned in advance

and conducted system actually. For this reason a template for software

testing should be defined for the software process. Testing is vital to the

success of the system. System testing makes a logical assumption that all

parts of the system are correct and the goal will be successively achieved.

Inadequate testing or no testing leads to error that may not appear until

month later.

There

are several

types of

BCA PROJECT
183

testing to check /remove different types of errors as far as possible from the

programs. Some very important are-

UNIT TESTING :-

Unit testing focuses verification effort on the smallest unit of software

design – the software component or module. The unit test is white-box

oriented and the step can be conducted in parallel for multiple components.

Unit testing is normally considered as an adjunct to the coding step. After

source level code has been developed, reviewed and verified for

correspondence to component level design, unit test case designs begin. A

review of design information provider guidance for establishing test cases

that is likely to uncover errors in each of the categories. Each test case

should be coupled with a set of expected results. Because a component is

not a stand-alone program, driver software must be developed for each unit

test. Driver accepts test case date, passes such data to the component and

prints relevant results. After passing test case data to the component,

expected results are obtained.

BCA PROJECT
184

INTEGRATION AND SYSTEM TESTING: -

When the individual program modules were working properly, we combined

the module into a working system. This integration is planned and co-

ordinate so that when an error occurs, we have an idea of what caused it.

Integration is the process of verifying that the components of the system

work together. For testing the entire system was viewed as a hierarchy of

modules. We began with the highest level of design and worked down. The

next modules to be tested are those that call the previously tested modules.

For example, variables used for record sets and connections that are

frequently called across forms from modules.

Function Test

Once we were sure that information is passed among modules according to

the design prescription we tested the system to assure whether the function

described the requirement specification were actually performed by the

integrated system.

Acceptance Test

BCA PROJECT
185

When the function test was completed, we involved the user to make sure

that the system worked according to user’s expectation. Thus the user did

the final acceptance test.

Installation Test

When acceptance test was completed, the acceptance system was

installed in the environment in which it would be used and a final

installation test was performed to make sure that the system function as it

should.

WHITE BOX TESTING:-

Also called ‘Structural Testing / Glass Box Testing’ is used for testing the

code keeping the system specs in mind. For this Developers Test following

test

Mutation Testing

A kind of testing in which, the application is tested for the code that was

modified after fixing a particular bug/defect. It also helps in finding out

which code and which strategy of coding can help in developing the

functionality effectively.

Control StructureTesting

The Flow of control execution path is considered for testing. It does also

BCA PROJECT
186

checks Conditional Testing, Branch Testing, Domain Testing, Data Flow

Testing, Loop testing such as Simple, Nested, Conditional, Unstructured

Loops.

BLACK BOX TESTING :-

Also called ‘Functional Testing’ as it concentrates on testing of the

functionality rather than the internal details of code. Test cases are

designed based on the task descriptions

Comparison Testing

Test cases results are compared with the results of the test Oracle.

Graph Based Testing

Cause and effect graphs are generated and cyclometric complexity

considered in using the test cases.Boundary Value TestingBoundary

values of the Equivalence classes are considered and tested as they

generally fail in Equivalence class testing.

IMPLEMENTATION : -

Once the system was tested satisfactorily, and then comes the

implementation of the system. Implementation is the process of changing

from old system to new system. But before implementing the new system,

BCA PROJECT
187

all the data should be transferred from the old system to the new system. In

our case as the existing system was a manual one without a homogeneous

data source, it was thought prudent to enter the master table thorough

various formatted forms. Efforts are on to complete the master table

creation and implement the system in full.

MAINTENANCE: -

I
t has been estimated that maintenance of any Software product usually

requires much more effort than the effort necessary to develop the

product. Many studies indicate that the relative effort of development of a

typical system to its maintenance effort is roughly in the 40:60 ratios.

Maintenance involves performing any one or more of the following three

kinds of activities:

Correcting errors that were not discovered during the product development

phase. This is called corrective maintenance. Improving the implementation

of the system and enhancing the functionality of the system according to

the customer’s requirements. This is called perfect maintenance. Porting

the Software to a new environment, e.g. to a new Computer or to a new

Operating System. This is called adaptive maintenance. In the proposed

project we had done corrective maintenance and adaptive maintenance.

BCA PROJECT
188

CODE OPTIMIZATION: -

When I was creating this application in Visual Basic then I expect to give

the best results using minimal computer resources such as memory and

hardware space. In order to ensure that my application uses the minimal

resources I tried time to time it for improving its performance. I started my

process of optimization from the designing stage itself and continued till the

deployment and distribution stage. I kept in my mind this theory that “A

well-designed application is the first step towards an optimized application”.

Following are the most important factors, which support me to develop this

application according to the requirement of users.

The speed with which an application executes is one of the most important

parameters to measure its performance. I used the following techniques to

optimize the speed of my application: -

 Used an appropriate data type

 Assigned properly values of variables

 Used early binding instead of late binding

 Used a collection instead of any array

BCA PROJECT
189

In my application, I have also used some advanced optimization options.

These are as follows: -

 Assume no aliasing

 Remove array bounds checks

 Remove integer overflow checks

 Remove floating points error checks

 Allow in rounded floating point operations

 And lastly there are some more topics on optimizing which gives me

a great support to enhance the performance of my application:

Minimizing the dots.

 Using the with …end statement

 Minimizing cross process calls

 Using module level variable instead of static variable

 Use constants

 Using the Live methods instead of the Pset method

Testing Types
Unit testing

BCA PROJECT
190

Unit testing, also known as component testing refers to tests that verify the

functionality of a specific section of code, usually at the function level. In an

object-oriented environment, this is usually at the class level, and the

minimal unit tests include the constructors and destructors.

These types of tests are usually written by developers as they work on

code (white-box style), to ensure that the specific function is working as

expected. One function might have multiple tests, to catch corner cases or

other branches in the code. Unit testing alone cannot verify the functionality

of a piece of software, but rather is used to ensure that the building blocks

of the software work independently from each other.

Unit testing is a software development process that involves synchronized

application of a broad spectrum of defect prevention and detection

strategies in order to reduce software development risks, time, and costs.

System testing

System testing, or end-to-end testing, tests a completely integrated system

to verify that it meets its requirements For example, a system test might

involve testing a logon interface, then creating and editing an entry, plus

BCA PROJECT
191

sending or printing results, followed by summary processing or deletion (or

archiving) of entries, then logoff.

In addition, the software testing should ensure that the program, as well as

working as expected, does not also destroy or partially corrupt its operating

environment or cause other processes within that environment to become

inoperative (this includes not corrupting shared memory, not consuming or

locking up excessive resources and leaving any parallel processes

unharmed by its presence).

Installation testing

An installation test assures that the system is installed correctly and

working at actual customer's hardware.

Alpha testing

Alpha testing is simulated or actual operational testing by potential

users/customers or an independent test team at the developers' site. Alpha

testing is often employed for off-the-shelf software as a form of internal

acceptance testing, before the software goes to beta testing.

BCA PROJECT
192

Beta testing

Beta testing comes after alpha testing and can be considered a form of

external user acceptance testing. Versions of the software, known as beta

versions, are released to a limited audience outside of the programming

team known as beta testers. The software is released to groups of people

so that further testing can ensure the product has few faults or bugs. Beta

versions can be made available to the open public to increase the feedback

field to a maximal number of future users and to deliver value earlier, for an

extended or even infinite period of time (perpetual beta).[citation needed]

Functional vs non-functional testing

Functional testing refers to activities that verify a specific action or function

of the code. These are usually found in the code requirements

documentation, although some development methodologies work from use

cases or user stories. Functional tests tend to answer the question of "can

the user do this" or "does this particular feature work."

Non-functional testing refers to aspects of the software that may not be

related to a specific function or user action, such as scalability or other

performance, behavior under certain constraints, or security. Testing will

BCA PROJECT
193

determine the breaking point, the point at which extremes of scalability or

performance leads to unstable execution. Non-functional requirements tend

to be those that reflect the quality of the product, particularly in the context

of the suitability perspective of its users.

White-Box testing

White-box testing (also known as clear box testing, glass box testing,

and transparent box testing and structural testing) tests internal

structures or workings of a program, as opposed to the functionality

exposed to the end-user. In white-box testing an internal perspective of the

system, as well as programming skills, are used to design test cases. While

white-box testing can be applied at the unit, integration and system levels

of the software testing process, it is usually done at the unit level. It can test

paths within a unit, paths between units during integration, and between

subsystems during a system–level test. Though this method of test design

can uncover many errors or problems, it might not detect unimplemented

parts of the specification or missing requirements.

Techniques used in white-box testing include:

BCA PROJECT
194

 API testing (application programming interface) – testing of the

application using public and private APIs

 Code coverage – creating tests to satisfy some criteria of code

coverage

 Fault injection methods – intentionally introducing faults to gauge the

efficacy of testing strategies

 Mutation testing methods

 Static testing methods

Black-box testing

Black-box testing treats the software as a "black box", examining

functionality without any knowledge of internal implementation. The testers

are only aware of what the software is supposed to do, not how it does it.

Black-box testing methods include: equivalence partitioning, boundary

value analysis, all-pairs testing, state transition tables, decision table

testing, fuzz testing, model-based testing, use case testing, exploratory

testing and specification-based testing.

Specification-based testing aims to test the functionality of software

according to the applicable requirements. This level of testing usually

requires thorough test cases to be provided to the tester, who then can

BCA PROJECT
195

simply verify that for a given input, the output value (or behavior), either "is"

or "is not" the same as the expected value specified in the test case. Test

cases are built around specifications and requirements, i.e., what the

application is supposed to do. It uses external descriptions of the software,

including specifications, requirements, and designs to derive test cases.

These tests can be functional or non-functional, though usually functional.

Specification-based testing may be necessary to assure correct

functionality, but it is insufficient to guard against complex or high-risk

situations.

One advantage of the black box technique is that no programming

knowledge is required.

BCA PROJECT

You might also like