Click here to Skip to main content
11,721,053 members (80,904 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Threading
Hi there,

I converted the project A Simple Crawler Using C# Sockets to C# 2010.

The Programm is reading information for the work from the UI Thread in the worker thread.

It is done like:
string strUri = comboBoxWeb.Text.Trim();


What do I have to do be able to run the programm in the new C# version?
Is it necessary to use an invoke?

greetings
delicious cake
Posted 16-Nov-10 10:56am
Edited 16-Nov-10 21:49pm
Dalek Dave433.2K
v2
Comments
ManfredRBihy at 16-Nov-10 17:52pm
   
Did you run into any problems? Did you find any issues?
Dalek Dave at 17-Nov-10 3:49am
   
Edited for Readability.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Yes, thats one way of doing it

something like:
static void Thread(object state)
{
   MyForm param = (MyForm)state;
   string file = string.Empty;
   param.Invoke(new MethodInvoker(delegate
   {
      string strUri = comboBoxWeb.Text.Trim();
   }));
}

don't use BeginInvoke since you need a synchronous operation
  Permalink  
Comments
Dalek Dave at 17-Nov-10 3:49am
   
Good Call.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 500
1 OriginalGriff 334
2 Mika Wendelius 160
3 F-ES Sitecore 140
4 Maciej Los 80
0 Sergey Alexandrovich Kryukov 2,199
1 OriginalGriff 959
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540


Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 17 Nov 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100