Click here to Skip to main content
16,005,038 members
Home / Discussions / C#
   

C#

 
GeneralRe: To know which file was opened by an application. Pin
Dave Kreskowiak2-Feb-06 15:40
mveDave Kreskowiak2-Feb-06 15:40 
QuestionValidation of WinForm Data Pin
Wayne Phipps2-Feb-06 9:51
Wayne Phipps2-Feb-06 9:51 
QuestionPixel size of frame and control changed Pin
xjsun2-Feb-06 9:35
xjsun2-Feb-06 9:35 
AnswerRe: Pixel size of frame and control changed Pin
malharone2-Feb-06 11:15
malharone2-Feb-06 11:15 
GeneralRe: Pixel size of frame and control changed Pin
xjsun7-Feb-06 8:09
xjsun7-Feb-06 8:09 
GeneralRe: Pixel size of frame and control changed Pin
malharone7-Feb-06 8:11
malharone7-Feb-06 8:11 
Questionthread safe calls Pin
Manu_812-Feb-06 8:37
Manu_812-Feb-06 8:37 
AnswerRe: thread safe calls Pin
kasik2-Feb-06 9:35
kasik2-Feb-06 9:35 
It seems to me that you're making this more complicated than it needs to be with the use of an entirely seperate class (PrimeInfoThread) to run your other thread. Why don't you just have a method in your HomeForm class called ThreadProc() and then reference the UI components (labels, buttons, etc...) without passing them to another object. You can use the ParameterizedThreadStart delegate to pass the label 'slab' - although it might make more sense to just pass the string value of its Text property if thats the only reason you need it... If you do that, then the following code should make it thread safe...

This goes in the routine that starts the thread:
Thread t = new Thread(new ParameterizedThreadStart(ThreadProc));
t.Start(this.SLabel);
Then this in HomeForm:
private void ThreadProc(object data)
{
	EnumGetEDID InitEnumObj = new EnumGetEDID();
	InitEnumObj.AppInitEnum((Label)data); 
	UpdateUI();
}

private delegate void UpdateUIDelegate();
private void UpdateUI()
{
	if (this.InvokeRequired)
	{
		this.BeginInvoke(new UpdateUIDelegate(UpdateUI));
		return;
	}
	pictureBox1.Hide();
	panel4.Hide();
	button1.Show();
	button3.Show();
}
Hope this helps Smile | :)

Oh... forgot to say that this uses .Net Framework v2, since the ParameterizedThreadStart delegate isn't available in v1.1 D'Oh! | :doh:

Cheers,
Will H

-- modified at 15:41 Thursday 2nd February, 2006
GeneralRe: thread safe calls Pin
eligazit2-Feb-06 10:50
eligazit2-Feb-06 10:50 
GeneralRe: thread safe calls Pin
kasik2-Feb-06 11:01
kasik2-Feb-06 11:01 
GeneralRe: thread safe calls Pin
kasik2-Feb-06 11:19
kasik2-Feb-06 11:19 
GeneralRe: thread safe calls Pin
Dave Kreskowiak2-Feb-06 15:29
mveDave Kreskowiak2-Feb-06 15:29 
GeneralRe: thread safe calls Pin
kasik3-Feb-06 2:26
kasik3-Feb-06 2:26 
GeneralRe: thread safe calls Pin
Dave Kreskowiak3-Feb-06 3:07
mveDave Kreskowiak3-Feb-06 3:07 
GeneralRe: thread safe calls Pin
eligazit2-Feb-06 20:42
eligazit2-Feb-06 20:42 
GeneralRe: thread safe calls Pin
kasik3-Feb-06 2:32
kasik3-Feb-06 2:32 
Questiontransferring vb.net solution to c#.net Pin
kourvoisier2-Feb-06 8:34
kourvoisier2-Feb-06 8:34 
AnswerRe: transferring vb.net solution to c#.net Pin
malharone2-Feb-06 11:19
malharone2-Feb-06 11:19 
GeneralRe: transferring vb.net solution to c#.net Pin
kourvoisier2-Feb-06 11:20
kourvoisier2-Feb-06 11:20 
GeneralRe: transferring vb.net solution to c#.net Pin
malharone2-Feb-06 11:41
malharone2-Feb-06 11:41 
Questioncreating a truly transparent control Pin
melanieab2-Feb-06 7:58
melanieab2-Feb-06 7:58 
QuestionRe: creating a truly transparent control Pin
melanieab2-Feb-06 8:34
melanieab2-Feb-06 8:34 
AnswerRe: creating a truly transparent control Pin
microsoc2-Feb-06 21:15
microsoc2-Feb-06 21:15 
QuestionInserting a record and retrieving recordid Pin
moazzamahmed2-Feb-06 7:00
moazzamahmed2-Feb-06 7:00 
AnswerRe: Inserting a record and retrieving recordid Pin
Colin Angus Mackay2-Feb-06 7:25
Colin Angus Mackay2-Feb-06 7:25 

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.