Solved

VB6 ListView & (Sub)Item Colors

Posted on 2000-03-20
9
1,740 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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