[go: up one dir, main page]

0% found this document useful (0 votes)
280 views44 pages

Project Report PDF

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 44

1.

Introduction To Project:-

We want to create software which is useful for the all event planers name as “Grocery Store
Management ”.

The information include home page that includes login form ,Product sell form, Todays sell
form ,Customer data form, User form and logout. Consider the entire requirement ;

To store the secure data because all the record in computerized , with this software manual
works in terms of records are store in database, which are necessity and the way to automate the
manual work. This software easy to handle and access product , customer and sell information
etc., also provide to the system database.

1
2.Hardware And Software Requirement:

❖ Software Requirement:
• Windows 7
• Microsoft access 2007
• Visual basis .net 2012

❖ Hardware Requirement:
• 2.00 GHZ Processor
• 4 GB RAM
• 1 TB Hard disk
• 64 BYTE

2
I.Introduction to Visual Basic.net

This back of the given project is based on visual basis .net without any inclusion of other
languages or resources Microsoft access which is used in data base .

That’s due the conversion and ease of the language that is an appropriate too for creating such
mini project. Also it has several advantages over its other which is explain the below .

Visual basis [.Net](VB.Net) is a multi-paradigm, high –level programming language,


implemented on a .NET framework. Microsoft launch VB.NET in 2002 as successor to its
original visual basis language.

II.Introduction to Database Access

This mini project makes the use of Microsoft access for creating data base and storing the
values. Although it could have been done with other tools either but access has been
implemented in it for certain reasons , some of them being compatibility and ease.

3
3.DFD:

GROCERY SHOP MANAGEMENT

Login Form

MENU FORM

PRODUCT TODAYS CUSTOMER USER


SELL SELL DATA

Data
Base

Retrieve

4
4.ER-Diagram:

Password
Customer Username
Name

List of Login Search


address
Products
Phone

Product Sell Menu form Customer data

Add Edit

Delete
Search

User

Type
ID
Password
Username

5
5.Database Design :

1.Login Form:

NAME OF FIELD DATA TYPE DESCRIPTION


Username Text Used for Unique Identity
Password Number Used for Entering Password
User Type Text Type of User

2.Product Sell Form:


Name Of Field Data Type Description
Bill No Autonumber Used For Unique Identity

Customer Name Text Used For Entering Name

Address Text Used For Entering Address

Contact No Number Used For Entering Contact No

Date Number Used For Display A Date

Product Name Text Used For Entering Product Sold

Product Price Number Used For Entering Product Price

Quantity Number Used For Entering Quantity

Total Number Used For Display Grand Total

Seller Text Used For Display Seller

6
3.Product Information Form :
Name of Field Data Type Description
ID Number Used For Entering Product ID
Name Text Used For Entering Name
Price Number Used For Entering Price
Date Number Used For Display Date

7
6.Source Code:

Login Form:

Imports System.Data.OleDb

Public Class LoginForm1

Public a As Integer
Public b As Integer
Public security As String
Public user As String

Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data


Source=C:\Users\Akshay\Documents\Visual Studio 2019\products.mdb")
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles OK.Click

If Not cnn.State = ConnectionState.Open Then


'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM username where


uname='" & UsernameTextBox.Text & "' and upassword='" & PasswordTextBox.Text
& "'", cnn)
Dim dt As New DataTable
'fill data to datatable
da.Fill(dt)
a = dt.Rows.Count

If Not cnn.State = ConnectionState.Open Then


'open connection
cnn.Open()
End If

8
Dim daa As New OleDb.OleDbDataAdapter("SELECT * FROM username where
uname='" & UsernameTextBox.Text & "' and upassword='" & PasswordTextBox.Text
& "' and type='administrator'", cnn)
Dim dtt As New DataTable
'fill data to datatable
daa.Fill(dtt)
b = dtt.Rows.Count

user = UsernameTextBox.Text.ToUpper

If a = 1 And b = 1 Then
security = "Administrator"
ElseIf a = 1 And b = 0 Then
security = "User"

End If

If a = 1 Then

af3.Show()

Else
MsgBox("Check your username password", MsgBoxStyle.Critical)
End If

End Sub

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub

Private Sub LoginForm1_Load(sender As Object, e As EventArgs) Handles


MyBase.Load
Me.BackColor = Color.LightBlue
End Sub

9
Menu Form:

Imports System.Data.OleDb
Public Class af3

Private Sub Form3_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

ToolStripLabel2.Text = Today.Date

username.Text = LoginForm1.user

If LoginForm1.security = "Administrator" Then


ToolStripButton1.Enabled = True
ToolStripButton2.Enabled = True
ToolStripButton4.Enabled = True
BtnUser.Enabled = True
ElseIf LoginForm1.security = "User" Then
ToolStripButton1.Enabled = True
ToolStripButton4.Enabled = True

End If

ToolStripLabel1.Text = LoginForm1.security

Me.IsMdiContainer = True

End Sub

Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs)


Handles ToolStripButton1.Click

af1.MdiParent = Me
af2.Close()
sell.Close()
user.Close()
af1.Show()

End Sub

Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs)


Handles ToolStripButton2.Click

af2.MdiParent = Me

10
af1.Close()
sell.Close()
user.Close()
af2.Show()

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs)

End Sub

Public Sub New()

' This call is required by the designer.


InitializeComponent()

' Add any initialization after the InitializeComponent() call.

End Sub

Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)


Handles ToolStripButton3.Click
LoginForm1.Show()

Me.Close()

End Sub

Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs)


Handles BtnUser.Click

user.MdiParent = Me

af1.Close()
sell.Close()

af2.Close()

user.Show()

End Sub

Private Sub ToolStripButton4_Click_1(sender As Object, e As EventArgs)


Handles ToolStripButton4.Click

11
sell.MdiParent = Me

af1.Close()

user.Close()
af2.Close()

sell.Show()

End Sub

12
Product Sell Form :

Imports System.Data.OleDb

Public Class af1


Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Users\Akshay\Documents\Visual Studio 2019\products.mdb")
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim a As Boolean = False

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

sName.Text = LoginForm1.user
If LoginForm1.security = "Administrator" Then
ToolStripButton1.Enabled = True
ToolStripButton2.Enabled = True
ToolStripButton3.Enabled = True

End If

'for Bill No
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Customer", cnn)


Dim dt As New DataTable
da.Fill(dt)

Dim a As Integer = dt.Rows.Count


lbillno.Text = a + 3
cnn.Close()

GroupBox3.Location = New Point(350, 30)


RefreshData()
Me.BackColor = Color.Coral

End Sub

Private Sub RefreshData()


If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

13
Dim da As New OleDb.OleDbDataAdapter("SELECT ProductID, ProductName,
UnitPrice, pdate" & " FROM Products ORDER BY ProductID", cnn)
Dim dt As New DataTable
'fill data to datatable
da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dt

'close connection
cnn.Close()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Save.Click

Try

DataGridView1.Enabled = 1
'valid number
Dim intValue As Double
If Not Double.TryParse(TxPID.Text, intValue) And Not
Double.TryParse(TxUP.Text, intValue) Then

ToolStripLabel1.Text = "Please insert valid Data"

Else

Dim cmd As New OleDb.OleDbCommand

If Not cnn.State = ConnectionState.Open Then


'open connection if it is not yet open
cnn.Open()
End If

cmd.Connection = cnn
cmd.CommandText = "INSERT INTO Products(ProductID,
ProductName, UnitPrice, pdate) VALUES('" & TxPID.Text & "', '" &
TxPN.Text.ToUpper & "', " & TxUP.Text & ", '" & Today.Date & "')"
cmd.ExecuteNonQuery()

RefreshData()
ToolStripLabel1.Text = "New Data Is Added"
TxPID.Text = ""
TxPN.Text = ""
TxUP.Text = ""

TxPID.Focus()

14
cnn.Close()
End If

Catch ex As Exception
MsgBox("Product id repeat", MsgBoxStyle.Critical, "ERROR")
End Try

'update

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Cancel.Click

GroupBox2.Visible = False
GroupBox3.Visible = True
End Sub

Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs)


Handles ToolStripButton1.Click

GroupBox2.Visible = 1
GroupBox3.Visible = False
Save.Visible = 1
BtnUpdate.Visible = 0
TxPID.Focus()
TxPID.Text = ""
TxPN.Text = ""
TxUP.Text = ""
pdate.Text = ""

End Sub

Private Sub TxPID_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles TxPID.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") Then

If e.KeyChar <> ControlChars.Back Then

'cancel keys

e.Handled = True
End If

End If
End Sub

15
Private Sub TxPID_TextChanged(sender As Object, e As EventArgs) Handles
TxPID.TextChanged
Dim intValue As Double
If Not Double.TryParse(TxPID.Text, intValue) Then
Star1.Visible = 1

End If

End Sub

Private Sub TxUP_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles TxUP.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") Then

If e.KeyChar <> ControlChars.Back Then

'cancel keys

e.Handled = True
End If

End If
End Sub

Private Sub TxUP_TextChanged(sender As Object, e As EventArgs) Handles


TxUP.TextChanged
Dim intValue As Double
If Not Double.TryParse(TxUP.Text, intValue) Then
Star2.Visible = 1
AcceptButton = Save

End If
End Sub

Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs)


Handles ToolStripButton2.Click

For Each SelectedRow As DataGridViewRow In DataGridView1.SelectedRows


Dim value As String = (SelectedRow.Cells("ProductID").Value)

If Not cnn.State = ConnectionState.Open Then


cnn.Open()
End If

Dim cmd As New OleDb.OleDbCommand


cmd.Connection = cnn

16
cmd.CommandText = "DELETE FROM Products WHERE ProductID='" &
value & "'"
cmd.ExecuteNonQuery()
'refresh data
Me.RefreshData()
ToolStripLabel1.Text = "Selected Record is Deleted"
cnn.Close()
Next
End Sub

Private Sub ToolStripTextBox1_Click(sender As Object, e As EventArgs)


Handles ToolStripTextBox1.Click
ToolStripTextBox1.Text = ""
End Sub

Private Sub ToolStripTextBox1_KeyDown(sender As Object, e As


KeyEventArgs) Handles ToolStripTextBox1.KeyDown

Try

If e.KeyCode = Keys.Enter Then


e.SuppressKeyPress = True
TxBuyOrder.Focus()

'Do Stuff
End If
If e.KeyCode = Keys.Down Then

If DataGridView1.RowCount > 0 Then

Dim MyDesiredIndex As Integer = 0

If DataGridView1.CurrentRow.Index <
DataGridView1.RowCount - 1 Then
MyDesiredIndex = DataGridView1.CurrentRow.Index + 1
End If

DataGridView1.ClearSelection()
DataGridView1.CurrentCell =
DataGridView1.Rows(MyDesiredIndex).Cells(0)
DataGridView1.Rows(MyDesiredIndex).Selected = True
End If

End If

If e.KeyCode = Keys.Up Then

17
If DataGridView1.RowCount > 0 Then

Dim MyDesiredIndex As Integer = 0

If DataGridView1.CurrentRow.Index <
DataGridView1.RowCount Then
MyDesiredIndex = DataGridView1.CurrentRow.Index - 1
End If

DataGridView1.ClearSelection()
DataGridView1.CurrentCell =
DataGridView1.Rows(MyDesiredIndex).Cells(0)
DataGridView1.Rows(MyDesiredIndex).Selected = True
End If

End If

Catch ex As Exception

End Try

If e.KeyCode = Keys.Space Then


Button2.PerformClick()

End If

End Sub

Private Sub ToolStripTextBox1_TextChanged(sender As Object, e As


EventArgs) Handles ToolStripTextBox1.TextChanged
If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT ProductID, ProductName,


UnitPrice" & " FROM Products" & " Where ProductName LIKE '%" &
ToolStripTextBox1.Text & "%' Order by ProductID", cnn)
Dim dt As New DataTable
'fill data to datatable
da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dt

'close connection
cnn.Close()
End Sub

18
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)
Handles ToolStripButton3.Click
If DataGridView1.RowCount <= 0 Then

Else

BtnUpdate.Visible = 1
GroupBox2.Visible = 1
GroupBox3.Visible = 0
Save.Visible = 0
Dim i = DataGridView1.CurrentRow.Index
If i = -1 Then
MsgBox(" Can not be Update ")
End If
TxPID.Text = DataGridView1.Item(0, i).Value
TxPN.Text = DataGridView1.Item(1, i).Value
TxUP.Text = DataGridView1.Item(2, i).Value
pdate.Text = DataGridView1.Item(3, i).Value
End If
End Sub

Private Sub DataGridView1_CellContentDoubleClick(sender As Object, e As


DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
Try
Dim i = DataGridView1.CurrentRow.Index

TxPID.Text = DataGridView1.Item(0, i).Value


TxPN.Text = DataGridView1.Item(1, i).Value
TxUP.Text = DataGridView1.Item(2, i).Value
pdate.Text = DataGridView1.Item(3, i).Value

Catch ex As Exception

End Try
End Sub

Private Sub DataGridView1_SelectionChanged(sender As Object, e As


EventArgs) Handles DataGridView1.SelectionChanged
Try
Dim i = DataGridView1.CurrentRow.Index

TxPID.Text = DataGridView1.Item(0, i).Value


TxPN.Text = DataGridView1.Item(1, i).Value
TxUP.Text = DataGridView1.Item(2, i).Value

TxBuyPName.Text = DataGridView1.Item(1, i).Value


TxBuyPPrice.Text = DataGridView1.Item(2, i).Value
TxBuyOrder.Text = ""

19
Catch ex As Exception

End Try

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles


BtnUpdate.Click, BtnUpdate.Click
Try

Dim cmd As New OleDb.OleDbCommand


If Not cnn.State = ConnectionState.Open Then
'open connection if it is not yet open
cnn.Open()
End If

cmd.Connection = cnn

cmd.CommandText = "UPDATE Products SET ProductName='" &


TxPN.Text.ToString & "', UnitPrice=" & TxUP.Text & ", pdate='" &
DateTime.Now.ToString() & "' WHERE ProductID='" & TxPID.Text & "'"

cmd.ExecuteNonQuery()
cnn.Close()
RefreshData()
ToolStripLabel1.Text = "Record Updated"
Catch ex As Exception
MsgBox("something is wrong")
End Try
End Sub

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles


BtnBuy.Click
If TxBuyOrder.Text = "" Then
MsgBox("How Much You Want " & TxBuyPName.Text,
MsgBoxStyle.OkOnly)
Else

If TxCname.Text = "" Then


MsgBox("Please Enter Customer Name")
Else
ListBox1.Items.Add(TxBuyPName.Text)
ListBox2.Items.Add(TxUP.Text)
ListBox3.Items.Add(TxBuyOrder.Text)
ListBox4.Items.Add(TxBuyOrder.Text * TxUP.Text)
TxBuyOrder.Text = ""
TxBuyPName.Text = ""
TxBuyPPrice.Text = ""
CName.Text = TxCname.Text.ToUpper
CAddress.Text = TxCAddress.Text.ToUpper
Cphone.Text = TxCPhone.Text

20
LdATE.Text = Today.Date

End If
End If
ToolStripTextBox1.Focus()
ToolStripTextBox1.Text = ""
End Sub

Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles


Button2.Click
BtnPrint.Enabled = 1

If ListBox4.Items.Count = 0 Then
MsgBox("Nothing Added")
Else

Dim count As Integer


Dim c As Integer
Dim sum As Integer = 0
count = ListBox4.Items.Count

For c = 0 To count - 1
sum = sum + ListBox4.Items(c)
Total.Text = sum
Next

TxCAddress.Text = ""
TxCname.Text = ""
TxCPhone.Text = ""

'saving
Try

'list box 1 to string

Dim i As Integer = ListBox1.Items.Count - 1


Dim PNlist As String = " "
Dim BUnitPrice As String = " "
Dim BOrder As String = " "

For i = 0 To i
Dim a As String = ListBox1.Items(i)
Dim b As String = ListBox2.Items(i)
Dim d As String = ListBox3.Items(i)
PNlist = PNlist & "/" & a
BUnitPrice = BUnitPrice & "/" & b
BOrder = BOrder & "/" & d
Next

21
Dim cmd As New OleDb.OleDbCommand

If Not cnn.State = ConnectionState.Open Then


'open connection if it is not yet open
cnn.Open()
End If

cmd.Connection = cnn
cmd.CommandText = "INSERT INTO Customer(BillNo, CName, CAddress,
CPhone, BProduct, BUnitPrice, BOrder, CDate, GT, seller) VALUES(" &
lbillno.Text & ", '" & CName.Text & "', '" & CAddress.Text & "', '" &
Cphone.Text & "', '" & PNlist & "', '" & BUnitPrice & "', '" & BOrder & "',
'" & Today.Date & "', " & Total.Text & ", '" & sName.Text & "')"
cmd.ExecuteNonQuery()

ToolStripLabel1.Text = "New Data Is Added"

cnn.Close()

Catch ex As Exception

End Try

End If

End Sub

Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles


BtnPrint.Click
print.Show()

End Sub

22
Private Sub TxBuyOrder_KeyDown(sender As Object, e As KeyEventArgs)
Handles TxBuyOrder.KeyDown

If e.KeyCode = Keys.Enter Then


e.SuppressKeyPress = True
BtnBuy.PerformClick()

'Do Stuff
End If
End Sub

Private Sub TxCPhone_KeyDown(sender As Object, e As KeyEventArgs) Handles


TxCPhone.KeyDown
If e.KeyCode = Keys.Enter Then
ToolStripTextBox1.Focus()
e.SuppressKeyPress = True
'Do Stuff
End If
End Sub

Private Sub TxCname_KeyDown(sender As Object, e As KeyEventArgs) Handles


TxCname.KeyDown
If e.KeyCode = Keys.Enter Then
TxCAddress.Focus()
e.SuppressKeyPress = True
End If
End Sub

Private Sub TxCAddress_KeyDown(sender As Object, e As KeyEventArgs)


Handles TxCAddress.KeyDown
If e.KeyCode = Keys.Enter Then
TxCPhone.Focus()
e.SuppressKeyPress = True

23
End If
End Sub

Public Sub clearbill()


LdATE.Text = ""
lbillno.Text = ""
CName.Text = ""
CAddress.Text = ""
Cphone.Text = ""
Total.Text = ""
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
ListBox4.Items.Clear()

End Sub

Private Sub TxCPhone_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles TxCPhone.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") Then

If e.KeyChar <> ControlChars.Back Then

'cancel keys

e.Handled = True
End If

End If
End Sub

Private Sub TxBuyOrder_KeyPress(sender As Object, e As KeyPressEventArgs)


Handles TxBuyOrder.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") Then

If e.KeyChar <> ControlChars.Back Then

'cancel keys

e.Handled = True
End If

End If
End Sub

24
Sell Form :

Imports System.Data.OleDb

Public Class sell


Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Users\Akshay\Documents\Visual Studio 2019\products.mdb")

Dim s As String = ""

Private Sub RefreshData()


If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT * from customer", cnn)


Dim dt As New DataTable
'fill data to datatable
da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dt

'close connection
cnn.Close()
End Sub

Private Sub sell_Load(sender As Object, e As EventArgs) Handles


MyBase.Load
ToolStripComboBox1.SelectedText = Today.Date

txuser.Text = LoginForm1.UsernameTextBox.Text.ToUpper
If LoginForm1.security = "User" Then
txuser.Enabled = False

End If
search()

End Sub

Private Sub ToolStripComboBox1_SelectedIndexChanged(sender As Object, e


As EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged
search()

End Sub

25
Public Sub search()

Dim dt As Integer = ToolStripComboBox1.SelectedIndex

If dt = 0 Then
s = Today.Date

ElseIf dt = 1 Then
s = Today.Month

ElseIf dt = 2 Then
s = Today.Year

End If

'If LoginForm1.security = "Administrator" Then

If Not cnn.State = ConnectionState.Open Then


'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Customer where


seller='" & txuser.Text & "' and cdate like '%" & s & "%' ", cnn)
Dim dtt As New DataTable
'fill data to datatable
da.Fill(dtt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dtt

'close connection
cnn.Close()

' End If

End Sub

26
Private Sub txuser_TextChanged(sender As Object, e As EventArgs) Handles
txuser.TextChanged
search()

End Sub

Private Sub ToolStripComboBox1_TextChanged(sender As Object, e As


EventArgs) Handles ToolStripComboBox1.TextChanged
s = ToolStripComboBox1.Text
search()

End Sub

27
Data Form :

Imports System.Data.OleDb
Public Class af2
Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Users\Akshay\Documents\Visual Studio 2019\products.mdb")
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim a As String = ""
Private Sub RefreshData()
If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("select * FROM Customer", cnn)

Dim dt As New DataTable

'fill data to datatable


da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dt
'close connection
cnn.Close()
End Sub

Public Sub search()

Dim d As Integer = ToolStripComboBox1.SelectedIndex

If d = 0 Then
a = Today.Date
ElseIf d = 1 Then
a = Today.Month

ElseIf d = 2 Then
a = Today.Year

ElseIf d = 3 Then

a = ""

End If

28
If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Customer WHERE


CDate LIKE'%" & a & "%'", cnn)
Dim dt As New DataTable
'fill data to datatable
da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dt

'close connection
cnn.Close()

End Sub

Private Sub Ref()


If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT ProductID, ProductName,


UnitPrice, pdate" & " FROM Products ORDER BY ProductID", cnn)
Dim dt As New DataTable

'fill data to datatable


da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView2.DataSource = dt

'close connection

29
cnn.Close()
End Sub

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

Ref()
RefreshData()

End Sub

Private Sub ToolStripTextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles ToolStripTextBox1.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") Then

If e.KeyChar <> ControlChars.Back Then

'cancel keys

e.Handled = True
End If

End If
End Sub

Private Sub ToolStripTextBox1_TextChanged(sender As Object, e As


EventArgs) Handles ToolStripTextBox1.TextChanged

If Not cnn.State = ConnectionState.Open Then


'open connection
cnn.Open()
End If

Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM Customer WHERE


BillNo LIKE'" & ToolStripTextBox1.Text & "'", cnn)
Dim dt As New DataTable
'fill data to datatable
da.Fill(dt)

'offer data in data table into datagridview


Me.DataGridView1.DataSource = dt

'close connection
cnn.Close()

30
End Sub

Private Sub ToolStripComboBox1_SelectedIndexChanged(sender As Object, e


As EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged
search()

End Sub

Private Sub ToolStripComboBox1_TextChanged(sender As Object, e As


EventArgs) Handles ToolStripComboBox1.TextChanged
a = ToolStripComboBox1.Text

search()

End Sub

31
User Form:

Imports System.Data.OleDb
Public Class user

Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data


Source=C:\Users\Akshay\Documents\Visual Studio 2019\products.mdb")
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Private Sub RefreshData()
If Not cnn.State = ConnectionState.Open Then
'open connection
cnn.Open()
End If

Dim du As New OleDb.OleDbDataAdapter("select * from username", cnn)


Dim dut As New DataTable

'fill data to datatable


du.Fill(dut)

'offer data in data table into datagridview

Me.dgUser.DataSource = dut
'close connection
cnn.Close()
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Me.BackColor = Color.Coral
Password.UseSystemPasswordChar = True
repassword.UseSystemPasswordChar = True
RefreshData()

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Btnsave.Click

If Me.ID.Tag & "" = "" Then 'checking update or add new

'add

Try

32
If repassword.Text = Password.Text Then

Dim cmd As New OleDb.OleDbCommand

If Not cnn.State = ConnectionState.Open Then


'open connection if it is not yet open
cnn.Open()
End If

cmd.Connection = cnn
cmd.CommandText = "INSERT INTO username( id, uname,
upassword, type) VALUES(" & ID.Text & ", '" & username.Text & "', '" &
Password.Text & "', '" & Type.Text & "')"
cmd.ExecuteNonQuery()

cnn.Close()
RefreshData()

Else
MsgBox("Please enter valid password combination")
End If

Catch ex As Exception
MsgBox("cann't add new user somthing is wrong")
End Try

Else
'update

End If

ID.Text = ""
username.Text = ""
Password.Text = ""
repassword.Text = ""
Type.Text = ""

End Sub

33
Private Sub dgUser_CellDoubleClick(sender As Object, e As
DataGridViewCellEventArgs) Handles dgUser.CellDoubleClick
Try

Dim count As Integer = dgUser.CurrentRow.Index


ID.Text = dgUser.Item(0, count).Value
username.Text = dgUser.Item(1, count).Value
Password.Text = dgUser.Item(2, count).Value
repassword.Text = dgUser.Item(2, count).Value
Type.Text = dgUser.Item(3, count).Value

btnupdate.Visible = 1
Btnsave.Visible = 0

Catch ex As Exception
MsgBox("somthing is wrong")
End Try

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles


Button2.Click
btnupdate.Visible = False
Btnsave.Visible = True
username.Text = ""
Password.Text = ""
repassword.Text = ""
ID.Text = ""
Type.Text = ""
End Sub

Private Sub dgUser_KeyDown(sender As Object, e As KeyEventArgs) Handles


dgUser.KeyDown

Try
If e.KeyCode = Keys.Delete Then

Dim result As DialogResult = MsgBox("Do you want to delete


!!!", MsgBoxStyle.OkCancel)
If result = Windows.Forms.DialogResult.OK Then

Dim i As Integer = dgUser.CurrentRow.Index


Dim id As Integer = dgUser.Item(0, i).Value

34
If Not cnn.State = ConnectionState.Open Then
'open connection if it is not yet open
cnn.Open()
End If

Dim cmd As New OleDbCommand


cmd.Connection = cnn
cmd.CommandText = "delete * from username where id=" & id
& ""
cmd.ExecuteNonQuery()

RefreshData()

cnn.Close()
End If
End If

Catch ex As Exception
MsgBox("somthing is wrong")
End Try

End Sub

Private Sub btnupdate_Click(sender As Object, e As EventArgs) Handles


btnupdate.Click
If Password.Text = repassword.Text Then

Try
cnn.Open()
Dim cmd As New OleDbCommand
cmd.Connection = cnn
cmd.CommandText = "UPDATE username set uname='" &
username.Text & "', upassword='" & Password.Text & "', type='" & Type.Text &
"' where id=" & ID.Text & ""

cmd.ExecuteNonQuery()
cnn.Close()
RefreshData()
btnupdate.Visible = False
Btnsave.Visible = True

Catch ex As Exception
MsgBox("something is wrong!!")

End Try
ID.Text = ""
username.Text = ""
Password.Text = ""
repassword.Text = ""
Type.Text = ""
Else
MsgBox("password do not match!!", MsgBoxStyle.Exclamation)

35
End If

End Sub

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)


Handles CheckBox1.CheckedChanged

If CheckBox1.Checked Then
Password.UseSystemPasswordChar = False
repassword.UseSystemPasswordChar = False
Else
Password.UseSystemPasswordChar = True
repassword.UseSystemPasswordChar = True

End If

End Sub

Private Sub ID_KeyPress(sender As Object, e As KeyPressEventArgs) Handles


ID.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") Then

If e.KeyChar <> ControlChars.Back Then

'cancel keys

e.Handled = True
End If

End If
End Sub

36
Print Form :

Public Class print

Private Sub print_Load(sender As Object, e As EventArgs) Handles


MyBase.Load

With af1
lbillno.Text = .lbillno.Text
CName.Text = .CName.Text
CAddress.Text = .CAddress.Text
LdATE.Text = .LdATE.Text
Cphone.Text = .Cphone.Text
Total.Text = .Total.Text
sName.Text = .sName.Text

For i As Int32 = 0 To .ListBox1.Items.Count - 1


ListBox1.Items.Add(.ListBox1.Items(i).ToString.ToUpper)
ListBox2.Items.Add(.ListBox2.Items(i).ToString.ToUpper)
ListBox3.Items.Add(.ListBox3.Items(i).ToString.ToUpper)
ListBox4.Items.Add(.ListBox4.Items(i).ToString.ToUpper)
Next

End With

End Sub

Private Sub BtnPrint_Click(sender As Object, e As EventArgs) Handles


BtnPrint.Click
BtnPrint.Visible = False

PrintForm1.Print()

End Sub

37
7.Screen Layout:

Login Form:

Menu form:

38
Product Sell :

Add Product:

39
Sell :

Data :

40
User :

Print Preview :

41
8.Scope And Limitations:

Daily functions like Sell Product, Add Product, monitor customer and
overall management of various sellers can be easily performed with higher accuracy after the
installation of Grocery software. The modules of Grocery Shop Management software are
user-friendly and easy to access.

Improve data security. Better revenue management. Disadvantages: The most important
disadvantage included reducing access, reducing the rate of Sell and increasing employees'
workload and dissatisfaction. How will we calculate damage product??

42
9.Conclusion:

Thus we have designed our project which is very useful to the Grocery Shop Management.It
includes following objectives Facility to store the information of login,Product sell, add, remove
and also edit product.

• Updates all record according to their necessities.


• Search all old record of any customer.
• Facility to keep record safely without loss.

Our project is very user friendly and any user who uses it will find easy to use.

43
10.Bibilography:

Book Name:

Beingnning Visual Basis 2012 Ivor Horton Wrox

VB.net made simple programe Soma Dasgupta BPB

and poject

Reference Website:

https://www.google.co.in/webhp

https://www.codewithc,com/category/projects/vb-net-project

https://www.w3school.com

44

You might also like