Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void highToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Process process in processeslist)
            {
                try
                {
                    if (process.ProcessName == listview.SelectedItems[0].Text)
                    {
                        process.PriorityClass = ProcessPriorityClass.High;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show("SystemProcess priority cannot be changed");
                    break;
                }

                else
                {
                    process.PriorityClass = ProcessPriorityClass.High;
                }
            }
        }



ERROR : Invalid expression term 'else'


What is the problem?
Posted

1 solution

Your else does not match up with an if. Your if is inside the try catch and the else is outside. Just move the else inside the try statement.
 
Share this answer
 
Comments
Rig Trag 18-May-14 0:42am    
Program started, but not changing the process priority.
abdul subhan mohammed 18-May-14 3:52am    
http://www.codeproject.com/Questions/774581/Problem-with-sessions-in-javascript

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