Click here to Skip to main content
15,922,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends,
I am using C# for my work projects and I faced a problem that I would like to write for Alarm is Red and for warning is Blue.I solved it like this but there is an another problem.In the case ,first alarm doesn't fit in to the sequence.How can I solve this problem.

What I have tried:

C#
if(Convert.ToBoolean(M3177) && rep[0])
            {
                A1.Text = now;
                A1.SubItems.Add(alarms[0]);
                A1.ForeColor = listViewRed;
                rep[0] = false;
            }

            if (Convert.ToBoolean(M3176) && rep[1])
            {
                A2.Text = now;
                A2.SubItems.Add(alarms[1]);
                A2.ForeColor = listViewRed;
                rep[1] = false;
            }

            if (Convert.ToBoolean(M3175) && rep[2])
            {
                A3.Text = now;
                A3.SubItems.Add(alarms[2]);
                A3.ForeColor = listViewRed;
                rep[2] = false;
            }

            if (Convert.ToBoolean(M3174) && rep[3])
            {
                A4.Text = now;
                A4.SubItems.Add(alarms[3]);
                A4.ForeColor = listViewRed;
                rep[3] = false;
            }

            if (Convert.ToBoolean(M3173) && rep[4])
            {
                A5.Text = now;
                A5.SubItems.Add(alarms[4]);
                A5.ForeColor = listViewRed;
                rep[4] = false;
            }

            listView1.Items.Clear();
            listView1.Items.AddRange(new ListViewItem[] { A1, A2, A3, A4, A5 });
Posted
Comments
Maciej Los 15-Mar-18 2:38am    
Sorry, but haven't access to your HDD and we don't see your screen. Can you be more specific and provide more details about issue?

1 solution

Okay I solved it,

if (Convert.ToBoolean(M3176) && rep[1])
            {
                A2.Text = now;
                A2.SubItems.Add(alarms[1]);
                A2.ForeColor = listViewRed;
                rep[1] = false;
                listView1.Items.Add(A2);
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900