Click here to Skip to main content
15,889,536 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
VB
Notepad is a basic text-editing program and it's most commonly used to view or edit text files. A text file is a file type typically identified by the .txt file name extension.
Posted
Updated 11-Jun-13 21:25pm
v4
Comments
CHill60 12-Jun-13 7:10am    
Any particular reason for overwriting your year-old question with a statement about Notepad?
greatnishant 17-Mar-15 6:07am    
Nope
CHill60 17-Mar-15 6:16am    
Then why do it? Some members went to the trouble of answering your question - you've placed their responses entirely without a context

You should be able to use the Dispatcher[^] property on that. Use the Disptachers CheckAccess() method the check how to access the control. (note CheckAccess does not appear in intellisense.)

Here's a sample where the backgroundworker thread calls the SetMsg function to update the label control:

C#
private void SetMsg(string txt, string fulltxt){
	if(lbl_info.Dispatcher.CheckAccess()){
		lbl_info.Content = txt;
		fullinfomessage = txt + "\r\n" + fulltxt;
	}				//end if
	else{
		lbl_info.Dispatcher.Invoke(new UpdateTxt(SetMsg), new object [] { txt, fulltxt });
	}				//end else
}

//the delegate is defined as follows: private delegate void UpdateTxt(string txt, string fulltxt);


Hope this helps.
 
Share this answer
 
This article explains this topic very well. You should use the search functionality on CP to see if the answers to your questions already exist. Cheers.

Accessing Windows Forms Controls across Threads[^]
 
Share this answer
 

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