Click here to Skip to main content
15,908,768 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Win32 API usage from C# code not working on deployment environment Pin
Christian Graus7-Jun-08 6:04
protectorChristian Graus7-Jun-08 6:04 
GeneralRe: Win32 API usage from C# code not working on deployment environment Pin
impeham7-Jun-08 6:45
impeham7-Jun-08 6:45 
QuestionRe: Win32 API usage from C# code not working on deployment environment [modified] Pin
impeham7-Jun-08 13:34
impeham7-Jun-08 13:34 
QuestionHow can I Develope Telephony Applicatino/Auto Dialer Pin
Suresh Suthar6-Jun-08 23:41
professionalSuresh Suthar6-Jun-08 23:41 
AnswerRe: How can I Develope Telephony Applicatino/Auto Dialer Pin
Christian Graus7-Jun-08 6:04
protectorChristian Graus7-Jun-08 6:04 
GeneralRe: How can I Develope Telephony Applicatino/Auto Dialer Pin
Suresh Suthar7-Jun-08 6:07
professionalSuresh Suthar7-Jun-08 6:07 
QuestionNew Thread vs BeginInvoke vs BackgroundWorker Pin
supercat96-Jun-08 13:55
supercat96-Jun-08 13:55 
AnswerRe: New Thread vs BeginInvoke vs BackgroundWorker Pin
Rob Smiley8-Jun-08 3:28
Rob Smiley8-Jun-08 3:28 
This code is fine for running an async operation. .NET takes care of all the complicated stuff, so you don't need to do any explicit cleanup, the thread will finish and cleanup automatically when ThreadProc method exits.

The only thing to look out for is marshalling to the main thread if you want to update / read any ui elements, e.g. setting .Text property on a label control from within ThreadProc. In this case, you must do something like:

Private Delegate Sub UpdateLabelTextDelegate(ByVal value As String)

Private Sub UpdateLabelText(ByVal value As String)
    If Label1.InvokeRequired Then
        Label1.BeginInvoke(New UpdateLabelTextDelegate(AddressOf UpdateLabelText), New Object() {value})

    Else
        Label1.Text = value

    End If

End Sub


Also, the following can be used as a shortcut to read the label text (only in VS2008 though):

Dim value As String = If(Label1.InvokeRequired, CStr(Label1.Invoke(Function() Label1.Text)), Label1.Text)


Rob

"An eye for an eye only ends up making the whole world blind"

GeneralRe: New Thread vs BeginInvoke vs BackgroundWorker Pin
supercat98-Jun-08 15:50
supercat98-Jun-08 15:50 
GeneralRe: New Thread vs BeginInvoke vs BackgroundWorker Pin
Rob Smiley9-Jun-08 4:19
Rob Smiley9-Jun-08 4:19 
QuestionMixing Java and .Net Pin
#realJSOP6-Jun-08 9:41
professional#realJSOP6-Jun-08 9:41 
AnswerRe: Mixing Java and .Net Pin
Pete O'Hanlon6-Jun-08 9:53
mvePete O'Hanlon6-Jun-08 9:53 
GeneralRe: Mixing Java and .Net Pin
led mike6-Jun-08 10:43
led mike6-Jun-08 10:43 
GeneralRe: Mixing Java and .Net Pin
Pete O'Hanlon6-Jun-08 10:50
mvePete O'Hanlon6-Jun-08 10:50 
GeneralRe: Mixing Java and .Net Pin
led mike6-Jun-08 11:34
led mike6-Jun-08 11:34 
GeneralRe: Mixing Java and .Net Pin
Pete O'Hanlon6-Jun-08 11:42
mvePete O'Hanlon6-Jun-08 11:42 
QuestionReference library programatically Pin
almc6-Jun-08 5:21
almc6-Jun-08 5:21 
AnswerRe: Reference library programatically Pin
led mike6-Jun-08 6:09
led mike6-Jun-08 6:09 
AnswerRe: Reference library programatically Pin
Tariq A Karim9-Jun-08 16:46
Tariq A Karim9-Jun-08 16:46 
QuestionThird party frameworks Pin
Tim Holgerson5-Jun-08 5:19
Tim Holgerson5-Jun-08 5:19 
Answer[Cross Post] Re: Third party frameworks Pin
Scott Dorman5-Jun-08 15:53
professionalScott Dorman5-Jun-08 15:53 
QuestionCustom user control elements (web control) Pin
Cornelis Kruger4-Jun-08 22:32
Cornelis Kruger4-Jun-08 22:32 
AnswerRe: Custom user control elements (web control) Pin
Ashik Wani5-Jun-08 1:30
Ashik Wani5-Jun-08 1:30 
Questionapplication form size for different OS Pin
sailesh_gupta4-Jun-08 19:41
sailesh_gupta4-Jun-08 19:41 
AnswerRe: application form size for different OS Pin
Ashik Wani5-Jun-08 1:34
Ashik Wani5-Jun-08 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.