I have this application with a list box. When a button is clicked, certain things from my db is supposed to display. Along with the display comes column headers!!! It comes in the form of “{itemID = SW934, quantity = 10…” and so on. How do I get rid of the “{” and the column header??? Here is my current code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MICROLANDDataSet.Orders' table. You can move, or remove it, as needed.
Me.OrdersTableAdapter.Fill(Me.MICROLANDDataSet.Orders)
'TODO: This line of code loads data into the 'MICROLANDDataSet.Inventory' table. You can move, or remove it, as needed.
Me.InventoryTableAdapter.Fill(Me.MICROLANDDataSet.Inventory)
'TODO: This line of code loads data into the 'MICROLANDDataSet.Customers' table. You can move, or remove it, as needed.
Me.CustomersTableAdapter.Fill(Me.MICROLANDDataSet.Customers)
End Sub
Private Sub btnOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOut.Click
Dim query1 = From OUT In MICROLANDDataSet.Inventory
Where OUT.quantity <= 10
Order By OUT.description Descending
Select OUT.itemID, OUT.quantity, OUT.description
lstOutput.DataSource = query1.ToList
lstOutput.SelectedItem = Nothing
End Sub
End Class
Thanks guys. Any help is VERY WELCOME.
The problem is that
query1is an In-Memoery Queue Of Anonymous. In other words, it is a enumeration of objects of an undefined type. One way to get around this, is to concatenate your results into one string.and make query1 a
List(Of String)(You can format the string any way you wish.)Another option is to designate one of the fields as a display field.