Hello people. Ive got a problem with a listbox of mine. I have three lisboxes, one listbox1 is for product category, another lisbox2 is for the product itself in which it will appear after the user has chosen a product category AND another listbox3 which acts like a shopping cart in which the product that user has chosen will go to. When I click on product category there is no problem, the listbox2 will list all products, BUT when I select a product to go to my shopping cart(listbox3) this message will appear in listbox3 - System.Data.DataRowView

Here are my codes:

`'I believe the code below is the problem

Private Sub listCategory_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listCategory.SelectedIndexChanged
        Dim getCategoryDesc As MySqlCommand = New MySqlCommand("Select * from category where catDesc=@field2;", connection)
        Dim reader1 As MySqlDataReader

        Try
            With getCategoryDesc
                .Parameters.AddWithValue("@field2", listCategory.Text)
            End With

            reader1 = getCategoryDesc.ExecuteReader()
            If (reader1.Read()) Then
                txtcatNo.Text = (reader1("catNo"))
            End If

            getCategoryDesc.Dispose()
            reader1.Close()

        Catch ex As Exception

        End Try

        Try
            Dim category As String
            category = listCategory.Text
            Dim sqlcommand As String = "select product.prodNo, product.productDesc from product, category where category.catDesc='" & category & "' and product.catNo=category.catNo;"
            Dim adapter As New MySqlDataAdapter(sqlcommand, connection)
            Dim dataset As New DataSet
            adapter.Fill(dataset, "product")

            With listproduct
                .ValueMember = "prodNo"
                .DisplayMember = "productDesc"
                .DataSource = dataset.Tables("product")
                .SelectedValue = "prodNo"
                .SelectedIndex = 0
            End With


        Catch ex As Exception

        End Try

    End Sub

'What the code below does is that when the user clicks on an item it goes to the shoppingcart(listbox3)

    Private Sub listproduct_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listproduct.SelectedIndexChanged
        getprod()

        Try
            Dim i As Integer
            For i = 0 To listproduct.SelectedItems.Count - 1
                listItemsBought.Items.Add(listproduct.SelectedItems.Item(i))
            Next i
        Catch ex As Exception

        End Try

    End Sub

so thats my problem you guys. Help would be really appreciated

What is the exact error message?
Put a messagebox in the Catch statement: MessageBox.Show(ex.ToString)

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.