Link to home
Start Free TrialLog in
Avatar of PeterBaileyUk
PeterBaileyUk

asked on

Multi column vb.net listbox

I have a form see attached, I would like the bottom listbox to show other columns from the stored procedure but not sure how

currently the listbox is populated with one column

   Private Sub CBCWSelectedItems_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CBCWSelectedItems.SelectedIndexChanged
        Dim selectedIndex As Integer
        selectedIndex = CBCWSelectedItems.SelectedIndex
        Dim selectedItem As Object
        selectedItem = CBCWSelectedItems.SelectedItem
        'MessageBox.Show("Selected Item Text: " & selectedItem.ToString() & Microsoft.VisualBasic.Constants.vbCrLf &
        '                "Index: " & selectedIndex.ToString())
        ListMatrix.DataSource = GetMatrixData(selectedItem.ToString()).AsEnumerable().Select(Function(r) r.Field(Of String)("Word")).ToList()

    End Sub

Open in new window




the SP does this
o
      SELECT [dbo].[TblWords].Word, [ClientName],[StrFull]
      FROM [dbo].TblWords
      WHERE [word]= 'f18' and [StrFull] like 'f18'+N'%'
      GROUP BY [Word], [ClientName],[StrFull]
      ORDER BY [Word]
ee.JPG
ee2.JPG
ASKER CERTIFIED SOLUTION
Avatar of Deepak Lakkad
Deepak Lakkad
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PeterBaileyUk
PeterBaileyUk

ASKER

how do i implement that in my code
Hi,

Can you please explain, what do you want to do with multi columns?


- Deepak Lakkad
I experimented and did this

DataGridView1.DataSource = GetMatrixData("F18")

works fine