Solved

Multi column vb.net listbox

Posted on 2016-07-25
5
130 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 500 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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