Solved

VB6 ListView & (Sub)Item Colors

Posted on 2000-03-20
9
1,735 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

929 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

17 Experts available now in Live!

Get 1:1 Help Now