Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 849331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:05:26+00:00 2026-05-15T07:05:26+00:00

I am using this code: private void Form1_Load(object sender, EventArgs e) { } private

  • 0

I am using this code:

private void Form1_Load(object sender, EventArgs e)
{

}

private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
    string response = serialPort1.ReadLine();
    this.BeginInvoke(new MethodInvoker(
        () => textBox1.AppendText(response + "\r\n")
    ));
}

ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork);
Thread myThread = new Thread(myThreadDelegate);
myThread.Start();

but am getting lots of errors:

Error 2 The type or namespace name ‘ThreadStart’ could not be found
(are you missing a using directive or an assembly reference?)
C:\Users\alexluvsdanielle\AppData\Local\Temporary
Projects\WindowsFormsApplication1\Form1.cs 31 44
WindowsFormsApplication1

Error 3 The name ‘ThreadWork’ does not exist in the current context
C:\Users\alexluvsdanielle\AppData\Local\Temporary
Projects\WindowsFormsApplication1\Form1.cs 31 56
WindowsFormsApplication1

Error 4 The type or namespace name ‘Thread’ could not be found (are
you missing a using directive or an assembly reference?)
C:\Users\alexluvsdanielle\AppData\Local\Temporary
Projects\WindowsFormsApplication1\Form1.cs 32 31
WindowsFormsApplication1

Error 5 A field initializer cannot reference the non-static field,
method, or property ‘WindowsFormsApplication1.Form1.myThreadDelegate’
C:\Users\alexluvsdanielle\AppData\Local\Temporary
Projects\WindowsFormsApplication1\Form1.cs 32 38
WindowsFormsApplication1

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:05:26+00:00Added an answer on May 15, 2026 at 7:05 am

    Perhaps I’m mentioning the bleedin’ obvious here, but from the code example, your code block:

    ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork);
    Thread myThread = new Thread(myThreadDelegate);
    myThread.Start();
    

    Is not in a method. I have done this before.

    Once you have fixed this, the other answers will obviously then apply.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have to rebind the event that is handling the… May 16, 2026 at 5:36 pm
  • Editorial Team
    Editorial Team added an answer It took alot of searching to find this but it… May 16, 2026 at 5:36 pm
  • Editorial Team
    Editorial Team added an answer Have a look here: http://www.smashingmagazine.com/2009/01/22/ask-sm-how-to-create-a-colorful-sitemap-with-jquery/ May 16, 2026 at 5:36 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i am trying to create slider movement graphics. The code explain better this. using
I've just created a little app that programmatically compiles code using the C# Compiler,
This following code gives me the error below . I think I need InvokeRequired
I currently have a class of this form: class Abc { private readonly IDisposable
I am doing an win form application. I am using a tree view and
In c# I am using a PictureBox on a win form. I am trying
I saw a method called Control.FromHandle which (should) give you the access to it.
I made a launcher for my game server. (World of Warcraft) I want to
Here's what I'm doing. I have three properties: MomsBackground, DadsBackground and ChosenBackground. When Momsbackground
I had a problem that was partially solved. To explain it quickly : I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.