Solved

VB6 ListView & (Sub)Item Colors

Posted on 2000-03-20
9
1,729 Views
Last Modified: 2008-03-10
Hi,

Is there a way to set the forecolor of the subitems in a listview?

Thanks,

SLE
0
Comment
Question by:SLE
  • 4
  • 4
9 Comments
 
LVL 7

Expert Comment

by:Inteqam
ID: 2635478
dim ll as msComctllib.listitem
dim ss as msComctllib.Subitem

set ll = MyListView.addnew ,,"MyListItem"

set ss = ll.subitems.add ,,"MySubItem"

ss.ForeColor = VBRed .

0
 
LVL 2

Author Comment

by:SLE
ID: 2635501
Integam, I suppose your code should be:

Dim ll As MSComctlLib.ListItem
Dim ss As MSComctlLib.SubItem

Set ll = ListView1.addnew(, , "MyListItem")
Set ss = ll.SubItems.Add(, , "MySubItem")

ss.ForeColor = vbRed


The above returns an error on 'SubItem' - which does not exist.
0
 
LVL 2

Author Comment

by:SLE
ID: 2635502
Correction:

Dim ll As MSComctlLib.ListItem
Dim ss As MSComctlLib.SubItem

Set ll = ListView1.ListItems.Add(, , "MyListItem")
Set ss = ll.SubItems.Add(, , "MySubItem")

ss.ForeColor = vbRed
0
 
LVL 2

Author Comment

by:SLE
ID: 2635515
Correction:

Dim ll As MSComctlLib.ListItem
Dim ss As MSComctlLib.SubItem

Set ll = ListView1.ListItems.Add(, , "MyListItem")
Set ss = ll.SubItems.Add(, , "MySubItem")

ss.ForeColor = vbRed
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Expert Comment

by:Inteqam
ID: 2635606
i am not sure but try

Dim ss As MSComctlLib.ListSubItem

the problem that i don't have VB on the machine i am surfing from .
0
 

Accepted Solution

by:
hkshijun earned 50 total points
ID: 2635639
You can try this:
   
    Dim ll As MSComctlLib.ListItem
    Dim ss As MSComctlLib.ListSubItem 'not SubItem
   
    ListView1.ColumnHeaders.Add , , "h1"
    ListView1.ColumnHeaders.Add , , "h2"
    Set ll = ListView1.ListItems.Add(, , "MyListItem")
    Set ss = ll.ListSubItems.Add(, , "MySubItem")
    ss.ForeColor = vbRed
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 2635778
hkshijun

that was my second answer, what you did is merging my answer with my comment with SLE comments with two unnecessary lines to get an answer !!!!!!!!!

i supposed that the column headers are already there.

0
 
LVL 2

Author Comment

by:SLE
ID: 2635835
Sorry, Integam but hkshijun got me on the right way - thanks...
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 2637099
its ok

the most important thing is that you solved your problem

:o)

anytime am ready
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now