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. listview + selecteditem

listview + selecteditem

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
2 Posts 2 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Hi I always use the function 'selecteditem' of a listview to check what the selected item is. This works fine when there is something selected in the list .. when there are for example no entries it crashes on it. Code: This crashes when there is no entries in listview: msgbox lstArtikels.SelectedItem().Text how can i check if there are still entries in the list?

    D 1 Reply Last reply
    0
    • A Anonymous

      Hi I always use the function 'selecteditem' of a listview to check what the selected item is. This works fine when there is something selected in the list .. when there are for example no entries it crashes on it. Code: This crashes when there is no entries in listview: msgbox lstArtikels.SelectedItem().Text how can i check if there are still entries in the list?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Anonymous wrote: msgbox lstArtikels.SelectedItem().Text You can use SelectedItems.Count to see how many items are selected, then you can put up the Message Box:

      If lstArtikels.SelectedItems.Count > 0 Then
          For X = 0 to lstArtikels.SelectedItems.Count - 1
              MsgBox lstArtikels.SelectedItem(X).Text
          Next
      End If
      

      RageInTheMachine9532

      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