Friday, February 22, 2019

Groceries Store Software | vb.net

Groceries Store Software using vb.net

                   Watch the video available on YouTube:






More information about this video(coding):

Public Class Form1
    Const Price_MatchBox As Decimal = 1.0
    Const Price_Eggs As Decimal = 5.0
    Const Price_Milk As Decimal = 25
    Const Price_Cheese As Decimal = 20
    Const Price_Rice As Decimal = 26
    Const Price_Bread As Decimal = 12

    Dim itemcost(5) As Decimal
    Dim iTotal As Decimal


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        txtTotal.Text = "₹0"
    End Sub

    Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles BtnExit.Click
        Dim iExit As DialogResult
        iExit = MessageBox.Show("Confirm if You want to Exit", "VS Programs", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

        If iExit = DialogResult.Yes Then

            Application.Exit()
        End If
    End Sub

    Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles BtnClear.Click
        For Each chk In {ChkMatchBox, ChkEggs, ChkMilk, ChkCheese, ChkRice, ChkBread}
            chk.Checked = False
        Next
        txtTotal.Text = "₹0"
        txtReceipt.Clear()

    End Sub

    Private Sub ChkMatchBox_CheckedChanged(sender As Object, e As EventArgs) Handles ChkMatchBox.CheckedChanged
        PicMatchBox.BackColor = Color.GreenYellow
        ChkMatchBox.BackColor = Color.GreenYellow
        txtMatchBox.Enabled = True
        txtMatchBox.Text = "1"
        txtMatchBox.Focus()

        If ChkMatchBox.Checked = False Then
            PicMatchBox.BackColor = Color.WhiteSmoke
            ChkMatchBox.BackColor = Color.WhiteSmoke
            txtMatchBox.Enabled = False
            txtMatchBox.Text = "0"
        End If

    End Sub
    Private Sub ChkEggs_CheckedChanged(sender As Object, e As EventArgs) Handles ChkEggs.CheckedChanged
        PicEggs.BackColor = Color.GreenYellow
        ChkEggs.BackColor = Color.GreenYellow
        txtEggs.Enabled = True
        txtEggs.Text = "1"
        txtEggs.Focus()

        If ChkEggs.Checked = False Then
            PicEggs.BackColor = Color.WhiteSmoke
            ChkEggs.BackColor = Color.WhiteSmoke
            txtEggs.Enabled = False
            txtEggs.Text = "0"
        End If
    End Sub
    Private Sub ChkMilk_CheckedChanged(sender As Object, e As EventArgs) Handles ChkMilk.CheckedChanged
        PicMilk.BackColor = Color.GreenYellow
        ChkMilk.BackColor = Color.GreenYellow
        txtMilk.Enabled = True
        txtMilk.Text = "1"
        txtMilk.Focus()

        If ChkMilk.Checked = False Then
            PicMilk.BackColor = Color.WhiteSmoke
            ChkMilk.BackColor = Color.WhiteSmoke
            txtMilk.Enabled = False
            txtMilk.Text = "0"
        End If
    End Sub
    Private Sub ChkCheese_CheckedChanged(sender As Object, e As EventArgs) Handles ChkCheese.CheckedChanged
        PicCheese.BackColor = Color.GreenYellow
        ChkCheese.BackColor = Color.GreenYellow
        txtCheese.Enabled = True
        txtCheese.Text = "1"
        txtCheese.Focus()

        If ChkCheese.Checked = False Then
            PicCheese.BackColor = Color.WhiteSmoke
            ChkCheese.BackColor = Color.WhiteSmoke
            txtCheese.Enabled = False
            txtCheese.Text = "0"
        End If
    End Sub
    Private Sub ChkRice_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRice.CheckedChanged
        PicRice.BackColor = Color.GreenYellow
        ChkRice.BackColor = Color.GreenYellow
        txtRice.Enabled = True
        txtRice.Text = "1"
        txtRice.Focus()

        If ChkRice.Checked = False Then
            PicRice.BackColor = Color.WhiteSmoke
            ChkRice.BackColor = Color.WhiteSmoke
            txtRice.Enabled = False
            txtRice.Text = "0"
        End If
    End Sub
    Private Sub ChkBread_CheckedChanged(sender As Object, e As EventArgs) Handles ChkBread.CheckedChanged
        PicBread.BackColor = Color.GreenYellow
        ChkBread.BackColor = Color.GreenYellow
        txtBread.Enabled = True
        txtBread.Text = "1"
        txtBread.Focus()

        If ChkBread.Checked = False Then
            PicBread.BackColor = Color.WhiteSmoke
            ChkBread.BackColor = Color.WhiteSmoke
            txtBread.Enabled = False
            txtBread.Text = "0"
        End If
    End Sub
    Private Sub Numbers_Only(sender As Object, e As KeyPressEventArgs) Handles txtMatchBox.KeyPress, txtEggs.KeyPress, txtMilk.KeyPress,
        txtCheese.KeyPress, txtRice.KeyPress, txtBread.KeyPress
        If Asc(e.KeyChar) <> 8 Then
            If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
                e.Handled = True
            End If
        End If
    End Sub

    Private Sub BtnTotal_Click(sender As Object, e As EventArgs) Handles BtnTotal.Click
        itemcost(0) = Convert.ToDecimal(txtMatchBox.Text) * Price_MatchBox
        itemcost(1) = Convert.ToDecimal(txtEggs.Text) * Price_Eggs
        itemcost(2) = Convert.ToDecimal(txtMilk.Text) * Price_Milk
        itemcost(3) = Convert.ToDecimal(txtCheese.Text) * Price_Cheese
        itemcost(4) = Convert.ToDecimal(txtRice.Text) * Price_Rice
        itemcost(5) = Convert.ToDecimal(txtBread.Text) * Price_Bread

        iTotal = itemcost(0) + itemcost(1) + itemcost(2) + itemcost(3) + itemcost(4) + itemcost(5)
        txtTotal.Text = "₹" & iTotal

    End Sub

    Private Sub BtnPrint_Click(sender As Object, e As EventArgs) Handles BtnPrint.Click
        txtReceipt.Font = New Font("Courier New", 10)
        txtReceipt.AppendText(" ")
        txtReceipt.AppendText(" " + vbNewLine)
        txtReceipt.AppendText(vbTab & "Groceries Store Software Receipt" + vbNewLine)
        txtReceipt.AppendText("==================================================" + vbNewLine)
        txtReceipt.AppendText("Order No:" & " " & "001" & vbNewLine)
        txtReceipt.AppendText(vbNewLine & "Date: " + vbTab & Date.Today + vbTab + "Time: " + vbTab & TimeOfDay + vbNewLine)
        txtReceipt.AppendText(vbNewLine & "Item Name" + vbTab + "Price" + vbTab + "Qty" + vbNewLine)
        txtReceipt.AppendText("__________________________________________________" + vbNewLine)

        If txtMatchBox.Text > 0 Then
            txtReceipt.AppendText(vbNewLine & "Match Box" + vbTab & "₹" & Price_MatchBox & vbTab + txtMatchBox.Text + vbNewLine)
        End If
        If txtEggs.Text > 0 Then
            txtReceipt.AppendText(vbNewLine & "Eggs     " + vbTab & "₹" & Price_Eggs & vbTab + txtEggs.Text + vbNewLine)
        End If
        If txtMilk.Text > 0 Then
            txtReceipt.AppendText(vbNewLine & "Milk     " + vbTab & "₹" & Price_Milk & vbTab + txtMilk.Text + vbNewLine)
        End If
        If txtCheese.Text > 0 Then
            txtReceipt.AppendText(vbNewLine & "Cheese   " + vbTab & "₹" & Price_Cheese & vbTab + txtCheese.Text + vbNewLine)
        End If
        If txtRice.Text > 0 Then
            txtReceipt.AppendText(vbNewLine & "Rice     " + vbTab & "₹" & Price_Rice & vbTab + txtRice.Text + vbNewLine)
        End If
        If txtBread.Text > 0 Then
            txtReceipt.AppendText(vbNewLine & "Bread    " + vbTab & "₹" & Price_Bread & vbTab + txtBread.Text + vbNewLine)
        End If
        txtReceipt.AppendText("__________________________________________________" + vbNewLine)
        txtReceipt.AppendText(vbNewLine & "Total" + vbTab + vbTab & txtTotal.Text & vbNewLine)
        txtReceipt.AppendText("--------------------------------------------------" + vbNewLine)
        txtReceipt.AppendText(vbTab + " Thank You, Visit Again" & vbNewLine)

    End Sub

End Class

Wednesday, February 13, 2019

Pop Up Window in visual studio | vb.net

Pop Up Window in visual studio using vb.net










Watch the video above on YouTube. the code used in this program is shown below:

For Form1:
Public Class Form1

    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
        Application.Exit()

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Form2.Show()

    End Sub
End Class


For Form2:
Public Class Form2

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Hide()

    End Sub
End Class

Wednesday, January 23, 2019

Designing calculator in visual studio using vb.net

Basic Calculator

Designing 


          Watch the video above on YouTube. 

For programming use the code below:

Public Class Form1
    Dim Firstnum As Decimal
    Dim secondnum As Decimal
    Dim Operations As Integer
    Dim Operator_selctor As Boolean = False

    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
        Application.Exit()

    End Sub

    Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles BtnClear.Click
        TextBox1.Text = "0"
    End Sub

    Private Sub BtnDivide_Click(sender As Object, e As EventArgs) Handles BtnDivide.Click
        Firstnum = TextBox1.Text 
        TextBox1.Text = ""
        Operator_selctor = True
        Operations = 4 ' = / 
    End Sub

    Private Sub BtnMultiply_Click(sender As Object, e As EventArgs) Handles BtnMultiply.Click
        Firstnum = TextBox1.Text
        TextBox1.Text = ""
        Operator_selctor = True
        Operations = 3 ' = *
    End Sub

    Private Sub BtnSubstract_Click(sender As Object, e As EventArgs) Handles BtnSubstract.Click
        Firstnum = TextBox1.Text
        TextBox1.Text = ""
        Operator_selctor = True
        Operations = 2 ' = -
    End Sub

    Private Sub BtnAdd_Click(sender As Object, e As EventArgs) Handles BtnAdd.Click
        Firstnum = TextBox1.Text
        TextBox1.Text = ""
        Operator_selctor = True
        Operations = 1 ' = +
    End Sub

    Private Sub BtnSyntax_Click(sender As Object, e As EventArgs) Handles BtnSyntax.Click
        If Operator_selctor = True Then
            secondnum = TextBox1.Text
            If Operations = 1 Then
                TextBox1.Text = Firstnum + secondnum
            ElseIf Operations = 2 Then
                TextBox1.Text = Firstnum - secondnum
            ElseIf Operations = 3 Then
                TextBox1.Text = Firstnum * secondnum
            Else
                If secondnum = 0 Then
                    TextBox1.Text = "Error!"
                Else
                    TextBox1.Text = Firstnum / secondnum
                End If
            End If
            Operator_selctor = False
        End If

    End Sub

    Private Sub BtnDot_Click(sender As Object, e As EventArgs) Handles BtnDot.Click
        If Not (TextBox1.Text.Contains(".")) Then
            TextBox1.Text += "."
        End If
    End Sub

    Private Sub Btn0_Click(sender As Object, e As EventArgs) Handles Btn0.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "0"
        End If
    End Sub

    Private Sub Btn1_Click(sender As Object, e As EventArgs) Handles Btn1.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "1"
        Else
            TextBox1.Text = "1"
        End If
    End Sub

    Private Sub Btn2_Click(sender As Object, e As EventArgs) Handles Btn2.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "2"
        Else
            TextBox1.Text = "2"
        End If
    End Sub

    Private Sub Btn3_Click(sender As Object, e As EventArgs) Handles Btn3.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "3"
        Else
            TextBox1.Text = "3"
        End If
    End Sub

    Private Sub Btn4_Click(sender As Object, e As EventArgs) Handles Btn4.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "4"
        Else
            TextBox1.Text = "4"
        End If
    End Sub

    Private Sub Btn5_Click(sender As Object, e As EventArgs) Handles Btn5.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "5"
        Else
            TextBox1.Text = "5"
        End If
    End Sub

    Private Sub Btn6_Click(sender As Object, e As EventArgs) Handles Btn6.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "6"
        Else
            TextBox1.Text = "6"
        End If
    End Sub

    Private Sub Btn7_Click(sender As Object, e As EventArgs) Handles Btn7.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "7"
        Else
            TextBox1.Text = "7"
        End If
    End Sub

    Private Sub Btn8_Click(sender As Object, e As EventArgs) Handles Btn8.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "8"
        Else
            TextBox1.Text = "8"
        End If
    End Sub

    Private Sub Btn9_Click(sender As Object, e As EventArgs) Handles Btn9.Click
        If TextBox1.Text <> "0" Then
            TextBox1.Text += "9"
        Else
            TextBox1.Text = "9"
        End If
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        BtnClear.PerformClick()

    End Sub

    Private Sub PictureBox1_MouseHover(sender As Object, e As EventArgs) Handles PictureBox1.MouseHover
        PictureBox1.BackColor = Color.Red
    End Sub

    Private Sub PictureBox1_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox1.MouseLeave
        PictureBox1.BackColor = Color.WhiteSmoke
    End Sub

End Class

Wednesday, December 19, 2018

Side menu Design in Visual Studio using vb.net

Side Menu Design 

This is a side menu designed and programmed in visual studio with basic design using vb.net language. This basic design tutorial is available on YouTube, The link to this video is given below. Also the code is available in the description of this video. 



Windows Preloader in Visual Studio using vb.net

Circular Progress Bar in Visual Studio



This is a basic loading pop-up window which could be helpful while programming. check-out the YouTube link below to watch the video to create the same circular progress bar. The extension used in visual studio for making this program is [Circular Progress Bar], available in Microsoft visual studio extensions library. The code is also available in the description of this video.