?
Solved

Transfering data in a listview box to another listview box

Posted on 2006-03-26
6
Medium Priority
?
240 Views
Last Modified: 2010-04-07
Hey Experts

I am making a software application for a salon company and I am using listview boxes to add products and services to the bill.

The problem is i dont know how to transfer the information stored in the listview box in frmProducts to the listview box in frmService and vice versa

Thank you

Northern_Lights
0
Comment
Question by:Nothern_Lights
  • 3
  • 2
6 Comments
 
LVL 13

Expert Comment

by:iHadi
ID: 16295787
Try the following code:

Dim lItem As ListItem
ListView2.ListItems.Clear
For Each lItem In frmProducts.ListView1.ListItems
    frmService.ListView2.ListItems.Add lItem.Index, lItem.Key, lItem.Text, lItem.Icon, lItem.SmallIcon
Next
0
 

Author Comment

by:Nothern_Lights
ID: 16298786
Hey iHadi

VB says that lItem is blank i have changed the code and it is now

Dim litem As ListItem
For Each litem In frmProducts.lstBill.ListItem
    FrmService.lstBill.ListItems.Add litem.Index, litem.Key, litem.Text, litem.Icon, litem.SmallIcon
Next

the code is in FrmService_FormLoad

Thanks

Nothern_Lights




0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 16300566
Try something like this:

Dim litem As ListItem
Dim x As Long
FrmService.lstBill.ListItems.Clear
For x = 1 To frmProducts.lstBill.ListItems.Count
    Set litem = FrmService.lstBill.ListItems.Add(, , lstBill.ListItems.Item(x))
Next x
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 28

Expert Comment

by:vinnyd79
ID: 16300597
I meant:

Dim litem As ListItem
Dim x As Long
FrmService.lstBill.ListItems.Clear
For x = 1 To frmProducts.lstBill.ListItems.Count
    Set litem = FrmService.lstBill.ListItems.Add(, , frmProducts.lstBill.ListItems.Item(x))
Next x
0
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 1400 total points
ID: 16300625
The above will transfer the item in the first column. To transfer subitems you would do somethong like this:

Dim litem As ListItem
Dim x As Long
FrmService.lstBill.ListItems.Clear
For x = 1 To frmProducts.lstBill.ListItems.Count
    Set litem = FrmService.lstBill.ListItems.Add(, , frmProducts.lstBill.ListItems.Item(x)) ' col 1
    litem.SubItems(1) = frmProducts.lstBill.ListItems.Item(x).SubItems(1) ' col2
    litem.SubItems(2) = frmProducts.lstBill.ListItems.Item(x).SubItems(2) ' col3
Next x
0
 

Author Comment

by:Nothern_Lights
ID: 16326266
Thank You very much vinnyd79 the code worked perfectly
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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 Month14 days, 1 hour left to enroll

809 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