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. Use of Listview

Use of Listview

Scheduled Pinned Locked Moved Visual Basic
database
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.
  • N Offline
    N Offline
    nazimghori
    wrote on last edited by
    #1

    Hello Every one, I am want addition of listview text and display it in label For eg: There is one listview and there are 3 records in it (100,200,300)respectively. now what i want is total of all these records and display it in lable1.text total =100+200+300(This numeric values comes from database) label1.text=total and this should happen each time at listview mouse double click event I stated below code in listview mouse double click event

    Dim Tot As Integer = 0

        For i As Integer = 0 To Me.lstview2.Items.Count - 1
            Tot += CInt(Me.lstview2.SelectedItems(i).SubItems(i).Text)
            Tot += CInt(Me.lstview2.SelectedItems(i).SubItems(i).Text)
        Next
    
        Me.Label1.Text = Tot
    

    but this only gives me position of the selected text So how shall i approach please suggest... Thank You :) :) :)

    T 1 Reply Last reply
    0
    • N nazimghori

      Hello Every one, I am want addition of listview text and display it in label For eg: There is one listview and there are 3 records in it (100,200,300)respectively. now what i want is total of all these records and display it in lable1.text total =100+200+300(This numeric values comes from database) label1.text=total and this should happen each time at listview mouse double click event I stated below code in listview mouse double click event

      Dim Tot As Integer = 0

          For i As Integer = 0 To Me.lstview2.Items.Count - 1
              Tot += CInt(Me.lstview2.SelectedItems(i).SubItems(i).Text)
              Tot += CInt(Me.lstview2.SelectedItems(i).SubItems(i).Text)
          Next
      
          Me.Label1.Text = Tot
      

      but this only gives me position of the selected text So how shall i approach please suggest... Thank You :) :) :)

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

      Change your code to something like this: Dim Tot As Integer = 0 For i As Integer = 0 To Me.lstview2.Items.Count - 1 Tot += CInt(Me.lstview2.Items(i).SubItems(1).Text) Next Me.Label1.Text = Tot you may have to change then 1 in 'SubItems(1)' to the column where your numbers are stored.

      Tosch

      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