troubleshooting Question

Question about a listview

Avatar of Peter Kiers
Peter KiersFlag for Netherlands asked on
.NET Programming
8 Comments1 Solution297 ViewsLast Modified:
Dear experts,

I have a listview on my form and when I press a button the methode
SetAlternateItemColours will be executed. This methode color the rows
of the listview. I like to hang this methode to the event of the listview.
Is that possible? And what event works?

And I like to use the color: $F9F9F9 instead of the WhiteSmoke.

Who knows the solutions and is willing to help me?

Peter


private void button3_Click(object sender, EventArgs e)
            {
         SetAlternateItemColours();
            }

        private void SetAlternateItemColours()
        {
            for (int i = 0; i <= lstvGlucose.Items.Count - 1; i += 1)
            {
                if (i % 2 == 0)
                {
                    lstvGlucose.Items[i].BackColor = System.Drawing.Color.White;
                }
                else
                {
                    lstvGlucose.Items[i].BackColor = System.Drawing.Color.WhiteSmoke;
                }
            }
        }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros