Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Hopefully easy threading question

Avatar of jvalescu
jvalescuFlag for United States of America asked on
C#
15 Comments1 Solution1108 ViewsLast Modified:
I'm implementing a threaded solution for the first time.  I have a function declared in my form class called Begin_Monitoring(string name, int interval).  
There is a button that starts this process and I've included the following code in my click event:


      private void btnBeginMonitoring_Click(object sender, System.EventArgs e)
            {
                        // Start a separate thread to perform the computer's move.
                        this.EnvironmentalMonitorThread = new Thread(new ThreadStart(this.Begin_Monitoring("Environment",30)));
                        this.EnvironmentalMonitorThread.IsBackground = true;
                        this.EnvironmentalMonitorThread.Priority = System.Threading.ThreadPriority.Lowest;
                        this.EnvironmentalMonitorThread.Name = "Environmental Monitor";
                        this.EnvironmentalMonitorThread.Start();
          }

When I try to compile it, I get a "Method Name Expected" error and it highlights "this.Begin_Monitoring("Environment",30)"   Why doesn't it consider Begin_Monitoring to be a method?  Or rather, how do I solve this?  

It's urgent, hence the points.
ASKER CERTIFIED SOLUTION
Avatar of Dmitry G
Dmitry GFlag of New Zealand imageSenior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answers