Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ListView Questions

Posted on 2000-02-29
2
Medium Priority
?
196 Views
Last Modified: 2012-05-04
I am returning data from an AS400 database,

i.e. I click a node in a treeview and then the corresponding data is displayed (at the moment) in a ListBox.

I want to change this to output the data to a ListView, as I do not want the data displayed to be just text; I want to be able to click on the data that my treeview control has retrieved and perform furthur actions on it, (pretty much an emulation of Windows Explorer)

So far I cannot get my ListView to display any output

Can somebody provide with some code to:

i) Display the results of my nodeclick in a ListView, i.e. the nodeclick brings back data from a database, and I want to display it in a Listview.

ii) Code for how to manipulate data once it is in the ListView

Cheers,

Matt.

0
Comment
Question by:Matt_Unsworth
[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 10

Accepted Solution

by:
caraf_g earned 90 total points
ID: 2568696
I am assuming that you had no problems displaying it in a list box, right?

In that case it's likely that you've just done something relatively basic wrong in your listview. If I'm mistaken, I'm sorry - didn't mean to be patronising....

Anyway, your list view's View property should be lvwReport

To add an item, check out the YourListView.ListItems.Add procedure

Make sure your list view has column headers.
use Yourlistview.ColumnHeaders.Add to add one


To set the text in a list item
ListItems(Index).Text = "Value"
This corresponds with the first column.

To set further columns, use the SubItems
SubItem(N) corresponds with column N+1

ListItems(Index).SubItems(1) = "hello"
ListItems(Index).SubItems(2) = "world"
etc.

You can't have more subitems than .ColumnHeaders.Count - 1

Er....

Also, check out the .SelectedItem property,


Some simple loops:

Dim objItem as ListItem

For lngCounter = 1 to YourListView.ListItems.Count
    Set objItem = YourListView.ListItems(lngCounter)
    With objItem
        .Text = "hello"
        .SubItems(1) = "World"
    End With
Next

to iterate through all items.

etc. etc. etc.

Does this help at all?
0
 

Author Comment

by:Matt_Unsworth
ID: 2579424
Cheers caraf_g  this has done the trick.

Matt.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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

721 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