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 calculate the value for listView subitems? [modified]

how to calculate the value for listView subitems? [modified]

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestiondatabase
3 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.
  • Z Offline
    Z Offline
    zhiyuan16
    wrote on last edited by
    #1

    dear all i am a newbie in vb6, so far i entountered a problem, how to calculate the value for listview subitem, my part code is here, anyone can help me, thanks a lot. actually i am calculating the pixel amount in each index: for example: index value: 0, 1, 2 ...255. when i click Button Execute in form frmHistogram: the code is following:

    Private Sub cmdExecute_Click()
    'Execute the computing

    EasyMain1.Histogram EBW8Image1.object, frmHistogramVector.EBWHistogramVector1.object
    
    
    frmHistogramVector.EBWHistogramVector1.Refresh
    frmHistogramVector.Show
    

    End Sub

    and i wanna put the variable a as my subitem value, the code is the following:

    Private Sub Form_Load()

      Dim Min As Long
      Dim Max As Long
      Min = 0
      Max = 255
    With ListView1
       
        .ColumnHeaders.Add          'add a couple columns
        .ColumnHeaders.Add
        .ColumnHeaders(1).Text = "Index"     'name the columns
        .ColumnHeaders(2).Text = "Count"
        .ColumnHeaders(1).Width = .Width \* 0.35  'column width based on width of list view
        .ColumnHeaders(2).Width = .Width \* 0.5
    
    Dim I As Long
    Dim a As Single
    
    With .ListItems
        For I = 0 To 255
        a = EasyMain1.AnalyseHistogram(EBWHistogramVector1.object, eImgPixelCount, 0, 255)
            With .Add(, , I)
                 .ListSubItems.Add , , a
               
            End With
        Next I
    End With
    
        
    End With
    

    End Sub

    however when i run program, one popup dialog remind me: invalid number of vector elements. what is problem here. thanks.

    modified on Monday, April 13, 2009 10:19 PM

    M 1 Reply Last reply
    0
    • Z zhiyuan16

      dear all i am a newbie in vb6, so far i entountered a problem, how to calculate the value for listview subitem, my part code is here, anyone can help me, thanks a lot. actually i am calculating the pixel amount in each index: for example: index value: 0, 1, 2 ...255. when i click Button Execute in form frmHistogram: the code is following:

      Private Sub cmdExecute_Click()
      'Execute the computing

      EasyMain1.Histogram EBW8Image1.object, frmHistogramVector.EBWHistogramVector1.object
      
      
      frmHistogramVector.EBWHistogramVector1.Refresh
      frmHistogramVector.Show
      

      End Sub

      and i wanna put the variable a as my subitem value, the code is the following:

      Private Sub Form_Load()

        Dim Min As Long
        Dim Max As Long
        Min = 0
        Max = 255
      With ListView1
         
          .ColumnHeaders.Add          'add a couple columns
          .ColumnHeaders.Add
          .ColumnHeaders(1).Text = "Index"     'name the columns
          .ColumnHeaders(2).Text = "Count"
          .ColumnHeaders(1).Width = .Width \* 0.35  'column width based on width of list view
          .ColumnHeaders(2).Width = .Width \* 0.5
      
      Dim I As Long
      Dim a As Single
      
      With .ListItems
          For I = 0 To 255
          a = EasyMain1.AnalyseHistogram(EBWHistogramVector1.object, eImgPixelCount, 0, 255)
              With .Add(, , I)
                   .ListSubItems.Add , , a
                 
              End With
          Next I
      End With
      
          
      End With
      

      End Sub

      however when i run program, one popup dialog remind me: invalid number of vector elements. what is problem here. thanks.

      modified on Monday, April 13, 2009 10:19 PM

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Are you stuck supporting an existing VB6 program or are you creating a new app?

      Never underestimate the power of human stupidity RAH

      Z 1 Reply Last reply
      0
      • M Mycroft Holmes

        Are you stuck supporting an existing VB6 program or are you creating a new app?

        Never underestimate the power of human stupidity RAH

        Z Offline
        Z Offline
        zhiyuan16
        wrote on last edited by
        #3

        thanks for your reply, i created new app using uersys lib.

        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