?
Solved

PLEASE HELP: Listview Issue

Posted on 2006-10-29
2
Medium Priority
?
194 Views
Last Modified: 2010-04-30
Hello All,
I have a listview with two 3 columns
columns:
Checkbox
String
Double

I need a way to find the string, get the double value of that row, then add another value to the existing value, then update the row's double value based on the string

Find string widget
value1 = current value in row

value2 = another value

value3 = new value

 (value1 + value2 = value3)
(1 + 1 = 2)

I wish to put value3 in the location of value1

Thanks again.
0
Comment
Question by:dheffley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17829345
dim l as long
dim i as Listitem

for l = 1 to listview.listitems.count
  set i = listview.listitems(l)
  if i.subitems(1) = "widget" then
     i.subitems(2) = i.subitems(2) + value2
  end if
next

0
 
LVL 14

Accepted Solution

by:
Shiju Sasidharan earned 2000 total points
ID: 17831626
place a listview, combobox and command button and try this code

Private Sub Command1_Click()
Dim oLst As ListItem
    Set oLst = ListView1.FindItem(Combo1.Text, lvwText)
    If oLst Is Nothing Then
        MsgBox "Unable to find searched string", vbExclamation
    Else
        MsgBox "Found element", vbInformation
        oLst.SubItems(1) = Val(oLst.SubItems(1)) + 1 'Adding 1 to item
        oLst.Selected = True
    End If
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim oLst As ListItem
    ListView1.ColumnHeaders.Clear
    ListView1.ColumnHeaders.Add , , "String", 2000
    ListView1.ColumnHeaders.Add , , "Double", 2000
    ListView1.View = lvwReport
    ListView1.HideSelection = False
    Combo1.Clear
    Command1.Caption = "Find and Add"
    For i = 1 To 10
        Set oLst = ListView1.ListItems.Add(, , "String" & i)
        'simply adding some random values
        oLst.SubItems(1) = Int(Rnd * 10)
        'adding search string
        Combo1.AddItem "String" & i
    Next
    Combo1.ListIndex = 0
End Sub
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question