The following example is in your main form. This can be called from your
main form *or from another thread which can be your class1. You just need
to pass the form ref to your class constructor or set a public static or
something so that class1 knows how to reference
"Form.UpdateDelegate("sometext");" (for example.) Note the InvokeRequired
and delegate stuff is there to make any calls from other threads are queued
to UI thread as you should not call UI controls from other threads.
Moreover, you can use this method to update any control in your forms
(pBars, etc.) Just create the right delegate and use the UpdateLabel
template as example for you new method. hth
private delegate void UpdateDelegate(string value);
public void UpdateLabel(string text)
{
if ( text == null )
throw new ArgumentNullException("text");
if ( InvokeRequired )
{
UpdateDelegate ud = new UpdateDelegate(UpdateLabel);
this.BeginInvoke(ud, new object[]{text});
}
else
{
this.label1.Text = text;
}
}
--
William Stacey, MVP
http://mvp.support.microsoft.com
"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:#q**************@TK2MSFTNGP09.phx.gbl...
I think my question was not clear. Here is a simpler scenario. If I want
to show text "Finished!" on myLabel1 on Form1 from Class1, how should I do
it? If I do this from the code behind of Form1, I can just write myLabel1.Text
= "Finished!", but I don't know how I can do this from Class1.
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:uS****************@TK2MSFTNGP11.phx.gbl... C# not provide solution for this. You can use either Managed FileCopyEx
implementation or SHFileOperation. Refer MSDN for how to
"Mohamed Oubouchil" <ou*******@hotmail.com> wrote in message
news:aa**************************@posting.google.c om... Dear All,
i am building a pocket pc program that will be copying a large file
from across a network. I am trying to show a progress bar for the file
being copied
can anyone tell me how to update the progress bar to reflect the
status of the copy process.
I am using system.io.file.copy
Please tell me step by step,
Best regards,
Mohamed Oubouchil