Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multi column vb.net listbox

Posted on 2016-07-25
5
Medium Priority
?
156 Views
Last Modified: 2016-07-25
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
0
Comment
Question by:PeterBaileyUk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
Deepak Lakkad earned 2000 total points
ID: 41727175
Hi,

ListBox control has MultiColumn Property. Which will show values of one field in multiple columns (Horizontal Columns).

But, If you want to show multiple column, you have to use DataGridView or ListView control.




- Deepak Lakkad
0
 

Author Comment

by:PeterBaileyUk
ID: 41727393
how do i implement that in my code
0
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 41727416
Hi,

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


- Deepak Lakkad
0
 

Author Comment

by:PeterBaileyUk
ID: 41727422
I experimented and did this

DataGridView1.DataSource = GetMatrixData("F18")

works fine
0
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 41727423
Good
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question