Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to show more than one database collumns in a listbox

How to show more than one database collumns in a listbox

Scheduled Pinned Locked Moved Visual Basic
databasetutorialquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    keninfo
    wrote on last edited by
    #1

    Hello all, Does anyone know how to show more than one database collumns in a listbox?? In documentation i read that it was not possible bus is there anyone who knows a backdoor for it? Thanks.

    T C 3 Replies Last reply
    0
    • K keninfo

      Hello all, Does anyone know how to show more than one database collumns in a listbox?? In documentation i read that it was not possible bus is there anyone who knows a backdoor for it? Thanks.

      T Offline
      T Offline
      Tirthadip
      wrote on last edited by
      #2

      if you just want to display data then while retrieving Concatenate it in sql query........but i dont think u can see more than one column in a listbox..may be i am wrong

      Tirtha Miles to go before I sleep

      1 Reply Last reply
      0
      • K keninfo

        Hello all, Does anyone know how to show more than one database collumns in a listbox?? In documentation i read that it was not possible bus is there anyone who knows a backdoor for it? Thanks.

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        Use a ListView. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

        K 2 Replies Last reply
        0
        • C CPallini

          Use a ListView. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

          K Offline
          K Offline
          keninfo
          wrote on last edited by
          #4

          Is it that easy? Shame on me!! I wil try it. Thanks

          1 Reply Last reply
          0
          • C CPallini

            Use a ListView. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

            K Offline
            K Offline
            keninfo
            wrote on last edited by
            #5

            But how will i bind the listview to the database table? There is no datasource property.

            T C 2 Replies Last reply
            0
            • K keninfo

              But how will i bind the listview to the database table? There is no datasource property.

              T Offline
              T Offline
              Tirthadip
              wrote on last edited by
              #6

              ListView doesn't have any datasource property...u have to add Items and Subitems to display ur data....

              Tirtha Miles to go before I sleep

              1 Reply Last reply
              0
              • K keninfo

                But how will i bind the listview to the database table? There is no datasource property.

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #7

                If you need an object exposing the DataSource property then use the DataGrid. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

                1 Reply Last reply
                0
                • K keninfo

                  Hello all, Does anyone know how to show more than one database collumns in a listbox?? In documentation i read that it was not possible bus is there anyone who knows a backdoor for it? Thanks.

                  T Offline
                  T Offline
                  Tirthadip
                  wrote on last edited by
                  #8

                  if u have a dataset(say myDataset) populated with your records then try this....(code is in vb.net) Dim lvItem As ListViewItem For i As Integer = 0 To myDataset.Tables(0).Rows.Count - 1 lvItem = New ListViewItem(myDataset.Tables(0).Rows(i).Item(0)) For j As Integer = 0 To NumberOfSelectedField lsItem.SubItems.Add(CStr(myDataset.Tables(0).Rows(i).Item(j + 1))) Next myListView.Items.Add(lvItem) Next

                  Tirtha Miles to go before I sleep

                  K 1 Reply Last reply
                  0
                  • T Tirthadip

                    if u have a dataset(say myDataset) populated with your records then try this....(code is in vb.net) Dim lvItem As ListViewItem For i As Integer = 0 To myDataset.Tables(0).Rows.Count - 1 lvItem = New ListViewItem(myDataset.Tables(0).Rows(i).Item(0)) For j As Integer = 0 To NumberOfSelectedField lsItem.SubItems.Add(CStr(myDataset.Tables(0).Rows(i).Item(j + 1))) Next myListView.Items.Add(lvItem) Next

                    Tirtha Miles to go before I sleep

                    K Offline
                    K Offline
                    keninfo
                    wrote on last edited by
                    #9

                    Thanks. I will try that.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups