Solved

VB6 ListView & (Sub)Item Colors

Posted on 2000-03-20
9
1,744 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
[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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to parse out a json string in VB6? 10 288
VBA/SQL - Connect to SQL server and pull data 4 135
Using "ScreenUpdating" 6 84
MS SQL Update query with connected table data 3 62
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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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