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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. List Box

List Box

Scheduled Pinned Locked Moved Visual Basic
question
5 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.
  • R Offline
    R Offline
    roger6897
    wrote on last edited by
    #1

    I have the following displayed in textboxes: Price: 1.8 Quantity: 6 , and the item (pencil) relating to the purchase in a combolistbox How do i get this three bits of information in one line of a listbox: e.g 6 pencils $1.80

    A 1 Reply Last reply
    0
    • R roger6897

      I have the following displayed in textboxes: Price: 1.8 Quantity: 6 , and the item (pencil) relating to the purchase in a combolistbox How do i get this three bits of information in one line of a listbox: e.g 6 pencils $1.80

      A Offline
      A Offline
      AliAmjad
      wrote on last edited by
      #2

      You should use ListView Control instead for such output. Add a ListView Control to your form then change its 'View' property to 'Details' then add columns to its Column collection according to your requirements, use the SubItems property of Listviewitem to display the data for Sub columns.

      AliAmjad(MCP)

      R 1 Reply Last reply
      0
      • A AliAmjad

        You should use ListView Control instead for such output. Add a ListView Control to your form then change its 'View' property to 'Details' then add columns to its Column collection according to your requirements, use the SubItems property of Listviewitem to display the data for Sub columns.

        AliAmjad(MCP)

        R Offline
        R Offline
        roger6897
        wrote on last edited by
        #3

        I am not familiar with the ListView control, would you be able to clarify or help with the listbox control

        A 1 Reply Last reply
        0
        • R roger6897

          I am not familiar with the ListView control, would you be able to clarify or help with the listbox control

          A Offline
          A Offline
          AliAmjad
          wrote on last edited by
          #4

          I have told you the way of setting up a ListView control according to your requirements, use Property window to add columns to your ListView Control through its Columns Property after setting these values you can use the following code to fill it:

              Dim lstitm1 As New ListViewItem("Pencil")
              lstitm1.SubItems.Add("$11.0") 'For Price
              lstitm1.SubItems.Add("2")     'For Quantity
          
              Me.ListView1.Items.Add(lstitm1)
          

          Hope it helps !

          AliAmjad(MCP)

          D 1 Reply Last reply
          0
          • A AliAmjad

            I have told you the way of setting up a ListView control according to your requirements, use Property window to add columns to your ListView Control through its Columns Property after setting these values you can use the following code to fill it:

                Dim lstitm1 As New ListViewItem("Pencil")
                lstitm1.SubItems.Add("$11.0") 'For Price
                lstitm1.SubItems.Add("2")     'For Quantity
            
                Me.ListView1.Items.Add(lstitm1)
            

            Hope it helps !

            AliAmjad(MCP)

            D Offline
            D Offline
            dexter9703
            wrote on last edited by
            #5

            Works, thanks for all your help

            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