For Each itm As ListViewItem In ListView1.Items
        If itm.Text <= CStr(56) Then
            itm.BackColor = Color.Orange
            itm.BackColor = ListView1.BackColor
        End If

this codes change background color of all items in listview....but i just want to change the forecolor mu value of stocks in listview in a column stocks..not all column..pls guys help me:(

Recommended Answers

All 5 Replies

forecolor mu value of stocks in listview in a column stocks

In C# this works for SubItems. Am sure you can convert it to what you need in VB.NET:

lvItem.UseItemStyleForSubItems = false;
lvItem.SubItems[2].BackColor = Color.Orange; // 2 should be the right column index

thank you very much 4 ur codes:)..but not working..
my problem is this codes select all items ni all column..
( For Each itm As ListViewItem In ListView1.Items) 'select all items

i want to select only one column to change a backcolor:)

tnx guys godblessyou:) hope u help me to solve this:)

Use a DataGridView rather than a ListView. That would allow you to change colours of individual cells in any way that you want. To change an individual cell you code

dgvData.Rows(row).Cells(col).Style.BackColor = Color.Thistle

replacing row& col with the 0-relative row and column numbers.

Simply replace BackColor with ForeColor, this will color your matching Item with a specified color from the code you posted.

Sorry. That's the problem with cut and paste (and old neurons). I forgot to change Back to Fore.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.