Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1818
  • Last Modified:

VB6 ListView & (Sub)Item Colors

Hi,

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

Thanks,

SLE
0
SLE
Asked:
SLE
  • 4
  • 4
1 Solution
 
InteqamCommented:
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
 
SLEAuthor Commented:
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
 
SLEAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
SLEAuthor Commented:
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
 
InteqamCommented:
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
 
hkshijunCommented:
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
 
InteqamCommented:
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
 
SLEAuthor Commented:
Sorry, Integam but hkshijun got me on the right way - thanks...
0
 
InteqamCommented:
its ok

the most important thing is that you solved your problem

:o)

anytime am ready
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now