If you've data-bound your ListBox then each item is a DataRowView, not a String. This means that you're seting the Value property of you parameter to a DataRowView. If you want the actual string displayed in the ListBox that corresponds to the SelectedItem you would need to use this:If you aren't using the ValueMember for any other purpose, you could set the ValueMember to the same column as the DisplayMember and just use the SelectedValue instead:VB Code:
da.SelectCommand.Parameters.Add("@Division", ListBox1.GetItemText(ListBox1.SelectedItem))Also, the ListViewItemCollection.Add method returns a ListViewItem object, so you should use that to add your subitems:VB Code:
da.SelectCommand.Parameters.Add("@Division", ListBox1.SelectedValue)VB Code:
For Each dr In dt.Rows Dim newItem As ListViewItem = ListView1.Items.Add(dr("license_id"), dr("product_name")) newItem.SubItems.Add(dr("company_name")) newItem.SubItems.Add(dr("po_number")) newItem.SubItems.Add(dr("date")) newItem.SubItems.Add(dr("users_licenses")) Next




Reply With Quote
