Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox3.Text = "Welcome to lumga book shop sales database" & vbNewLine & vbNewLine & _
               "--------- --------- ------- ------------- ---------- --------" & vbNewLine & vbNewLine & _
   "Your cashier :  " & Sales_Log_in.txtUsername.Text & vbNewLine & vbNewLine & _
              "##############################################################" & vbNewLine & vbNewLine & _
              "DESCRIPTION OF ITEMS" & "          " & "Quantity " & "        " & "Price" & vbNewLine

        If ComboBox1.SelectedIndex = 1 Then
            TextBox3.Text = TextBox3.Text & vbNewLine & ComboBox1.SelectedItem & "             " & TextBox7.Text & "          " & Inventory1.price1.Text
        End If
        TextBox3.Text = TextBox3.Text & vbNewLine


        If ComboBox1.SelectedIndex = 2 Then
            TextBox3.Text = TextBox3.Text & vbNewLine & ComboBox1.SelectedItem & "             " & TextBox7.Text & "         " & Inventory1.price2.Text
        End If
        TextBox3.Text = TextBox3.Text & vbNewLine
        If ComboBox1.SelectedIndex = 3 Then
            TextBox3.Text = TextBox3.Text & vbNewLine & ComboBox1.SelectedItem & "            " & TextBox7.Text & "            " & Inventory1.price3.Text
        End If
        TextBox3.Text = TextBox3.Text & vbNewLine

        If ComboBox1.SelectedIndex = 4 Then
            TextBox3.Text = TextBox3.Text & vbNewLine & ComboBox1.SelectedItem & "           " & TextBox7.Text & "          " & Inventory1.price4.Text
        End If
        TextBox3.Text = TextBox3.Text & vbNewLine

        If ComboBox1.SelectedIndex = 5 Then
            TextBox3.Text = TextBox3.Text & vbNewLine & ComboBox1.SelectedItem & "             " & TextBox7.Text & "           " & Inventory1.price5.Text

        End If
        TextBox3.Text = TextBox3.Text & vbNewLine
2
Contributors
3
Replies
25
Views
3 Years
Discussion Span
Last Post by Begginnerdev
0

It seems as if you are storing prices in another form?

May I suggest storing prices into a database?

Something as simple as:

tblItems
ID | Int ID Not Null
Item | VarChar(50) Not Null
Price | Decimal(10,2) Not Null

The example given above would be using SQL Server (You can find SQL Express for free here.)

Then connect to the database and use the database to retreive the item values.

Here is an example of connecting to the database.

You can use set the selected value of the combobox to populate your fields with the data from the database.

0

where do I have to put this

    tblItems
    ID | Int ID Not Null
    Item | VarChar(50) Not Null
    Price | Decimal(10,2) Not Null
0

That would be an example of table structure.

You will need to design your tables accordingly.

Remember to normalize your tables to ward off any redundancy that is not necessary.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.