I created a simple Point of Sale program without database in Visual Studio 2008 (VB.NET) and I want to output the number of money bills that are needed to complete the change of the customer

This is the preview of my program - https://ibb.co/R94400g

In the image, at the bottom of the form, I put a panel and there's a label and text box inside.

I want to show how many 1000, 500, 100, 50, and 20, that is needed to complete the change.

see the image for the desired output.

Thank you for your help :)

*Sorry for my bad english

Public Class Form1

    Private Sub cmbProduct_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbProduct.SelectedIndexChanged

        Select Case cmbProduct.Text
            Case "SAMSUNG"
                cmbModel.Items.Clear()
                txtDate.Text = ""
                txtPrice.Text = ""
                cmbModel.Items.Add("SAMSUNG GALAXY J2 32GB")
                cmbModel.Items.Add("SAMSUNG GALAXY J5 32GB")
                cmbModel.Items.Add("SAMSUNG GALAXY J7 60GB")
                cmbModel.Items.Add("SAMSUNG GALAXY S5 60GB")
                cmbModel.Items.Add("SAMSUNG GALAXY S6 60GB")
                cmbModel.Items.Add("SAMSUNG GALAXY S8 120GB")
                cmbModel.Items.Add("SAMSUNG GALAXY S9 120GB")

            Case "CHERRY MOBILE"
                cmbModel.Items.Clear()
                txtDate.Text = ""
                txtPrice.Text = ""
                cmbModel.Items.Add("CHERRY MOBILE FLARE S7")
                cmbModel.Items.Add("CHERRY MOBILE FLARE S7 PLUS")
                cmbModel.Items.Add("CHERRY MOBILE FLARE S7 PRIME")
                cmbModel.Items.Add("CHERRY MOBILE FLARE S7 DELUXE")
                cmbModel.Items.Add("CHERRY MOBILE FLARE X3")
                cmbModel.Items.Add("CHERRY MOBILE FLARE S8")

            Case "MYPHONE"
                cmbModel.Items.Clear()
                txtDate.Text = ""
                txtPrice.Text = ""
                cmbModel.Items.Add("MyPhone myX1")
                cmbModel.Items.Add("MyPhone SuperD D1")
                cmbModel.Items.Add("MyPhone my35")
                cmbModel.Items.Add("MyPhone my36")
                cmbModel.Items.Add("MyPhone MyXI1")
                cmbModel.Items.Add("MyPhone my33")

            Case "XIAOMI"
                cmbModel.Items.Clear()
                txtDate.Text = ""
                txtPrice.Text = ""
                cmbModel.Items.Add("Xiaomi Redmi Note 7 Pro")
                cmbModel.Items.Add("Xiaomi Redmi Note 7S")
                cmbModel.Items.Add("Xiaomi Redmi 7")
                cmbModel.Items.Add("Xiaomi Redmi Note 7")
                cmbModel.Items.Add("Xiaomi Redmi 7A")
                cmbModel.Items.Add("Xiaomi Redmi Note 7 Pro 128GB")

            Case "ASUS"
                cmbModel.Items.Clear()
                txtDate.Text = ""
                txtPrice.Text = ""
                cmbModel.Items.Add("Asus 6Z")
                cmbModel.Items.Add("Asus Zenfone Max Pro M1")
                cmbModel.Items.Add("Asus Zenfone Lite L1")
                cmbModel.Items.Add("Asus Zenfone Max M1")
                cmbModel.Items.Add("Asus Zenfone Max Pro M1 64GB")
                cmbModel.Items.Add("Asus ROG Phone")

            Case "REALME"
                cmbModel.Items.Clear()
                txtDate.Text = ""
                txtPrice.Text = ""
                cmbModel.Items.Add("Realme X")
                cmbModel.Items.Add("Realme 3 Pro")
                cmbModel.Items.Add("Realme 3i")
                cmbModel.Items.Add("Realme C2")
                cmbModel.Items.Add("Realme 3")
                cmbModel.Items.Add("Realme 2 Pro")
        End Select

    End Sub

    Private Sub cmbModel_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbModel.SelectedIndexChanged

        '---------------------------------------------ORDER DATE-----------------------------------------------------------

        '-------------Samsung Products---------------
        If cmbModel.SelectedItem = "SAMSUNG GALAXY J2 32GB" Then
            txtDate.Text = ""
            txtDate.Text = "01/07/2019"
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY J5 32GB" Then
            txtDate.Text = ""
            txtDate.Text = "23/07/2019"
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY J7 60GB" Then
            txtDate.Text = ""
            txtDate.Text = "03/07/2019"
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S5 60GB" Then
            txtDate.Text = ""
            txtDate.Text = "15/05/2019"
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S6 60GB" Then
            txtDate.Text = ""
            txtDate.Text = "19/06/2019"
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S8 120GB" Then
            txtDate.Text = ""
            txtDate.Text = "14/07/2019"
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S9 120GB" Then
            txtDate.Text = ""
            txtDate.Text = "08/08/2019"
        End If
        '-------------Samsung Products End---------------

        '-------------Cherry Mobile Products---------------
        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7" Then
            txtDate.Text = ""
            txtDate.Text = "01/07/2019"
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7 PLUS" Then
            txtDate.Text = ""
            txtDate.Text = "23/07/2019"
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7 PRIME" Then
            txtDate.Text = ""
            txtDate.Text = "03/07/2019"
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7 DELUXE" Then
            txtDate.Text = ""
            txtDate.Text = "15/05/2019"
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE X3" Then
            txtDate.Text = ""
            txtDate.Text = "19/06/2019"
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S8" Then
            txtDate.Text = ""
            txtDate.Text = "14/07/2019"
        End If
        '-------------Cherry Mobile Products End---------------

        '-------------MYPHONE Products---------------
        If cmbModel.SelectedItem = "MyPhone myX1" Then
            txtDate.Text = ""
            txtDate.Text = "01/07/2019"
        End If

        If cmbModel.SelectedItem = "MyPhone SuperD D1" Then
            txtDate.Text = ""
            txtDate.Text = "23/07/2019"
        End If

        If cmbModel.SelectedItem = "MyPhone my35" Then
            txtDate.Text = ""
            txtDate.Text = "03/07/2019"
        End If

        If cmbModel.SelectedItem = "MyPhone my36" Then
            txtDate.Text = ""
            txtDate.Text = "15/05/2019"
        End If

        If cmbModel.SelectedItem = "MyPhone MyXI1" Then
            txtDate.Text = ""
            txtDate.Text = "19/06/2019"
        End If

        If cmbModel.SelectedItem = "MyPhone my33" Then
            txtDate.Text = ""
            txtDate.Text = "14/07/2019"
        End If
        '-------------MYPHONE Products End---------------

        '-------------XIAOMI Products---------------
        If cmbModel.SelectedItem = "Xiaomi redmi Note 7 Pro" Then
            txtDate.Text = ""
            txtDate.Text = "01/07/2019"
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi Note 7S" Then
            txtDate.Text = ""
            txtDate.Text = "23/07/2019"
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi 7" Then
            txtDate.Text = ""
            txtDate.Text = "03/07/2019"
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi Note 7" Then
            txtDate.Text = ""
            txtDate.Text = "15/05/2019"
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi 7A" Then
            txtDate.Text = ""
            txtDate.Text = "19/06/2019"
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi Note 7 Pro 128GB" Then
            txtDate.Text = ""
            txtDate.Text = "14/07/2019"
        End If
        '-------------XIAOMI Products End---------------

        '-------------ASUS Products---------------
        If cmbModel.SelectedItem = "Asus 6Z" Then
            txtDate.Text = ""
            txtDate.Text = "01/07/2019"
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Max Pro M1" Then
            txtDate.Text = ""
            txtDate.Text = "23/07/2019"
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Lite L1" Then
            txtDate.Text = ""
            txtDate.Text = "03/07/2019"
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Max M1" Then
            txtDate.Text = ""
            txtDate.Text = "15/05/2019"
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Max pro M1 64GB" Then
            txtDate.Text = ""
            txtDate.Text = "19/06/2019"
        End If

        If cmbModel.SelectedItem = "Asus ROG Phone" Then
            txtDate.Text = ""
            txtDate.Text = "14/07/2019"
        End If
        '-------------ASUS Products End---------------

        '-------------Realme Products---------------
        If cmbModel.SelectedItem = "Realme X" Then
            txtDate.Text = ""
            txtDate.Text = "01/07/2019"
        End If

        If cmbModel.SelectedItem = "Realme 3 Pro" Then
            txtDate.Text = ""
            txtDate.Text = "23/07/2019"
        End If

        If cmbModel.SelectedItem = "Realme 3i" Then
            txtDate.Text = ""
            txtDate.Text = "03/07/2019"
        End If

        If cmbModel.SelectedItem = "Realme C2" Then
            txtDate.Text = ""
            txtDate.Text = "15/05/2019"
        End If

        If cmbModel.SelectedItem = "Realme 3" Then
            txtDate.Text = ""
            txtDate.Text = "19/06/2019"
        End If

        If cmbModel.SelectedItem = "Realme 2 Pro" Then
            txtDate.Text = ""
            txtDate.Text = "14/07/2019"
        End If
        '-------------Realme Products End---------------

        '---------------------------------------------ORDER DATE END-----------------------------------------------------------

        '--------------------------------------------PRICE---------------------------------------------------------------------
        '-------------Samsung Products---------------
        If cmbModel.SelectedItem = "SAMSUNG GALAXY J2 32GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 3000
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY J5 32GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 5000
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY J7 60GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 8200
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S5 60GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 6900
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S6 60GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 11100
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S8 120GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 15600
        End If

        If cmbModel.SelectedItem = "SAMSUNG GALAXY S9 120GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 22000
        End If
        '-------------Samsung Products End---------------

        '-------------Cherry Mobile Products---------------
        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7" Then
            txtPrice.Text = ""
            txtPrice.Text = 7550
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7 PLUS" Then
            txtPrice.Text = ""
            txtPrice.Text = 8550
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7 PRIME" Then
            txtPrice.Text = ""
            txtPrice.Text = 9550
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S7 DELUXE" Then
            txtPrice.Text = ""
            txtPrice.Text = 10500
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE X3" Then
            txtPrice.Text = ""
            txtPrice.Text = 7500
        End If

        If cmbModel.SelectedItem = "CHERRY MOBILE FLARE S8" Then
            txtPrice.Text = ""
            txtPrice.Text = 4800
        End If
        '-------------Cherry Mobile Products End---------------

        '-------------MYPHONE Products---------------
        If cmbModel.SelectedItem = "MyPhone myX1" Then
            txtPrice.Text = ""
            txtPrice.Text = 3000
        End If

        If cmbModel.SelectedItem = "MyPhone SuperD D1" Then
            txtPrice.Text = ""
            txtPrice.Text = 2500
        End If

        If cmbModel.SelectedItem = "MyPhone my35" Then
            txtPrice.Text = ""
            txtPrice.Text = 2700
        End If

        If cmbModel.SelectedItem = "MyPhone my36" Then
            txtPrice.Text = ""
            txtPrice.Text = 2800
        End If

        If cmbModel.SelectedItem = "MyPhone MyXI1" Then
            txtPrice.Text = ""
            txtPrice.Text = 3500
        End If

        If cmbModel.SelectedItem = "MyPhone my33" Then
            txtPrice.Text = ""
            txtPrice.Text = 4350
        End If
        '-------------MYPHONE Products End---------------

        '-------------XIAOMI Products---------------
        If cmbModel.SelectedItem = "Xiaomi redmi Note 7 Pro" Then
            txtPrice.Text = ""
            txtPrice.Text = 14550
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi Note 7S" Then
            txtPrice.Text = ""
            txtPrice.Text = 15000
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi 7" Then
            txtPrice.Text = ""
            txtPrice.Text = 14000
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi Note 7" Then
            txtPrice.Text = ""
            txtPrice.Text = 13550
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi 7A" Then
            txtPrice.Text = ""
            txtPrice.Text = 9300
        End If

        If cmbModel.SelectedItem = "Xiaomi Redmi Note 7 Pro 128GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 19500
        End If
        '-------------XIAOMI Products End---------------

        '-------------ASUS Products---------------
        If cmbModel.SelectedItem = "Asus 6Z" Then
            txtPrice.Text = ""
            txtPrice.Text = 6500
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Max Pro M1" Then
            txtPrice.Text = ""
            txtPrice.Text = 7550
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Lite L1" Then
            txtPrice.Text = ""
            txtPrice.Text = 4600
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Max M1" Then
            txtPrice.Text = ""
            txtPrice.Text = 6300
        End If

        If cmbModel.SelectedItem = "Asus Zenfone Max pro M1 64GB" Then
            txtPrice.Text = ""
            txtPrice.Text = 11500
        End If

        If cmbModel.SelectedItem = "Asus ROG Phone" Then
            txtPrice.Text = ""
            txtPrice.Text = 50550
        End If
        '-------------ASUS Products End---------------

        '-------------Realme Products---------------
        If cmbModel.SelectedItem = "Realme X" Then
            txtPrice.Text = ""
            txtPrice.Text = 3500
        End If

        If cmbModel.SelectedItem = "Realme 3 Pro" Then
            txtPrice.Text = ""
            txtPrice.Text = 8500
        End If

        If cmbModel.SelectedItem = "Realme 3i" Then
            txtPrice.Text = ""
            txtPrice.Text = 4900
        End If

        If cmbModel.SelectedItem = "Realme C2" Then
            txtPrice.Text = ""
            txtPrice.Text = 3550
        End If

        If cmbModel.SelectedItem = "Realme 3" Then
            txtPrice.Text = ""
            txtPrice.Text = 6000
        End If

        If cmbModel.SelectedItem = "Realme 2 Pro" Then
            txtPrice.Text = ""
            txtPrice.Text = 4550
        End If
        '-------------Realme Products End---------------
        '--------------------------------------------PRICE END-----------------------------------------------------------------

    End Sub

    Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click

        If txtAmount.Text = "" Then
            MessageBox.Show("Please enter the amount")

        Else
            txtChange.Text = txtAmount.Text - txtPrice.Text

        End If
    End Sub
End Class

I see a lot of unnecessary code. For example, every one of your

If cmbModel.SelectedItem
    .
    .
End If

blocks clears the value of txtDate.Text before setting it to a new value. You don't have to clear it before assigning a new value. Furthermore, no matter what the user selects you have to execute every If block. Replace these with a Select Case.

Alternately, you could create a dictionary where the key is the selected item text and the value is the desired value of txtDate.Text. A little extra work up front but it requires only one line of code to set the value of txtData.Text. That's a saving of about 400 lines. It's a lot easier to type in and maintain and a lot less prone to typos.

commented: I should tell a story about 6 sigma and the code was too small and therefore was unacceptable (Motorola days.) +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.