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. Using Listbox help

Using Listbox help

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
14 Posts 5 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.
  • B benny777ex

    Thanks for reply :) just want make something clear, does the order of the item count from the top?? if yes, so the top one is 0, second one is 1, third is 2, fifth is 4?

    T Offline
    T Offline
    The ANZAC
    wrote on last edited by
    #4

    that's correct. It's zero based indexing starting at the top. The last item will always be listbox1.items.count - 1. Remember the minus 1 when working with listboxes. You can also check if a listbox has any item selected through: if listbox1.selectedindex = -1 then 'none is selected end if

    Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"

    B 1 Reply Last reply
    0
    • T The ANZAC

      that's correct. It's zero based indexing starting at the top. The last item will always be listbox1.items.count - 1. Remember the minus 1 when working with listboxes. You can also check if a listbox has any item selected through: if listbox1.selectedindex = -1 then 'none is selected end if

      Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"

      B Offline
      B Offline
      benny777ex
      wrote on last edited by
      #5

      Thanks for your respond :) i have another question, I want to read the selected line with a text box, so I wrote: Display.Text = JobList.Items.Item(LineNumber.Text).ToString there are 2 textboxs: Display.Text, LineNumber.Text and 1 listbox: JobList but an error returned...

      S B 2 Replies Last reply
      0
      • B benny777ex

        Thanks for your respond :) i have another question, I want to read the selected line with a text box, so I wrote: Display.Text = JobList.Items.Item(LineNumber.Text).ToString there are 2 textboxs: Display.Text, LineNumber.Text and 1 listbox: JobList but an error returned...

        S Offline
        S Offline
        Sathesh Sakthivel
        wrote on last edited by
        #6

        benny777ex wrote:

        but an error returned

        What error?

        Regards, Satips.:rose:

        B 1 Reply Last reply
        0
        • S Sathesh Sakthivel

          benny777ex wrote:

          but an error returned

          What error?

          Regards, Satips.:rose:

          B Offline
          B Offline
          benny777ex
          wrote on last edited by
          #7

          uhh sorry I was wrong, resolved. Thanks

          Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

          S 1 Reply Last reply
          0
          • B benny777ex

            uhh sorry I was wrong, resolved. Thanks

            Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

            S Offline
            S Offline
            Sathesh Sakthivel
            wrote on last edited by
            #8

            Ok . No Problem.

            Regards, Satips.:rose:

            1 Reply Last reply
            0
            • B benny777ex

              Thanks for your respond :) i have another question, I want to read the selected line with a text box, so I wrote: Display.Text = JobList.Items.Item(LineNumber.Text).ToString there are 2 textboxs: Display.Text, LineNumber.Text and 1 listbox: JobList but an error returned...

              B Offline
              B Offline
              benny777ex
              wrote on last edited by
              #9

              benny777ex wrote:

              I want to read the selected line with a text box, so I wrote: Display.Text = JobList.Items.Item(LineNumber.Text).ToString there are 2 textboxs: Display.Text, LineNumber.Text and 1 listbox: JobList

              hi I have another question, Like I said, I want to read the selected line with textbox. how to highlight the line in the listbox? or is it possible to do some text change, such as make it bold, or add some extra text like: ">>" + the line in the list box + "<<" in the line in the listbox? Please Help, Thanks

              Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

              S 1 Reply Last reply
              0
              • B benny777ex

                benny777ex wrote:

                I want to read the selected line with a text box, so I wrote: Display.Text = JobList.Items.Item(LineNumber.Text).ToString there are 2 textboxs: Display.Text, LineNumber.Text and 1 listbox: JobList

                hi I have another question, Like I said, I want to read the selected line with textbox. how to highlight the line in the listbox? or is it possible to do some text change, such as make it bold, or add some extra text like: ">>" + the line in the list box + "<<" in the line in the listbox? Please Help, Thanks

                Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

                S Offline
                S Offline
                Sonia Gupta
                wrote on last edited by
                #10

                use the following framework base class and it's functions Imports Microsoft.VisualBasic.Compatibility.VB6 getitemdata setitemdata

                Sonia Gupta Soniagupta1@yahoo.co.in

                B 1 Reply Last reply
                0
                • S Sonia Gupta

                  use the following framework base class and it's functions Imports Microsoft.VisualBasic.Compatibility.VB6 getitemdata setitemdata

                  Sonia Gupta Soniagupta1@yahoo.co.in

                  B Offline
                  B Offline
                  benny777ex
                  wrote on last edited by
                  #11

                  Thanks for reply :) I had imported Microsoft.VisualBasic.Compatibility.VB6. but... how to use them?

                  Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

                  T 1 Reply Last reply
                  0
                  • B benny777ex

                    Thanks for reply :) I had imported Microsoft.VisualBasic.Compatibility.VB6. but... how to use them?

                    Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

                    T Offline
                    T Offline
                    The ANZAC
                    wrote on last edited by
                    #12

                    NO DON'T USE THAT PLEASE! That is a bad habit, to form a dependency on old vb6 methods, you should learn the new way because those methods will be phased out, most likely in the next edition. Do this: me.listbox1.selectedindex = 'whatever number between 0 and listbox1.count - 1 or a variable

                    Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"

                    B 1 Reply Last reply
                    0
                    • T The ANZAC

                      NO DON'T USE THAT PLEASE! That is a bad habit, to form a dependency on old vb6 methods, you should learn the new way because those methods will be phased out, most likely in the next edition. Do this: me.listbox1.selectedindex = 'whatever number between 0 and listbox1.count - 1 or a variable

                      Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"

                      B Offline
                      B Offline
                      benny777ex
                      wrote on last edited by
                      #13

                      Thanks again :) I used your way, it works beautifully.

                      Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

                      T 1 Reply Last reply
                      0
                      • B benny777ex

                        Thanks again :) I used your way, it works beautifully.

                        Benny Im using: Windows XP Professional SP2 Microsoft Visual Basic 2005 (.NET)

                        T Offline
                        T Offline
                        The ANZAC
                        wrote on last edited by
                        #14

                        Your welcome, anytime.

                        Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"

                        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