Click here to Skip to main content
15,905,967 members
Home / Discussions / C#
   

C#

 
GeneralRe: Interactive Service in Windows 7 Pin
1a3xxx7-Aug-12 2:07
1a3xxx7-Aug-12 2:07 
GeneralRe: Interactive Service in Windows 7 Pin
Dave Kreskowiak7-Aug-12 2:08
mveDave Kreskowiak7-Aug-12 2:08 
GeneralRe: Interactive Service in Windows 7 Pin
Eddy Vluggen7-Aug-12 2:41
professionalEddy Vluggen7-Aug-12 2:41 
GeneralRe: Interactive Service in Windows 7 Pin
1a3xxx7-Aug-12 2:54
1a3xxx7-Aug-12 2:54 
GeneralRe: Interactive Service in Windows 7 Pin
Eddy Vluggen7-Aug-12 3:24
professionalEddy Vluggen7-Aug-12 3:24 
GeneralRe: Interactive Service in Windows 7 Pin
Dave Kreskowiak7-Aug-12 2:07
mveDave Kreskowiak7-Aug-12 2:07 
GeneralRe: Interactive Service in Windows 7 Pin
1a3xxx7-Aug-12 2:09
1a3xxx7-Aug-12 2:09 
QuestionError: Text' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException' Pin
taibc6-Aug-12 20:24
taibc6-Aug-12 20:24 
Hi friends,

I am trying to create a new thread to convert a file. But when starting running it, I get this error:

{Text = '((System.Windows.Forms.TextBox)(txtAddress)).Text' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException'} System.Windows.Forms.TextBox

Please see my code:

C#
string sourceFile, destinationFile;

       private void ShowLoadingIcon()
       {
           if (InvokeRequired)
           {
               this.Invoke(new MethodInvoker(ShowLoadingIcon));

           }
           else
           {
               pixLoadingIcon.Visible = true;
           }
       }



       private void btnConvert_Click(object sender, EventArgs e)
       {
           ShowLoadingIcon();

           //start thread to process long running task
           System.Threading.Thread t = new System.Threading.Thread(() =>
           {
               ConvertFiles(sourceFile, destinationFile);
           });

           t.Start();

       }


       private void ConvertFiles(string src, string dest)
       {
           //long running task to convert files
       }


Are there anyone know how to fix it ?

Thanks and regards,
AnswerRe: Error: Text' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException' Pin
Richard MacCutchan6-Aug-12 21:02
mveRichard MacCutchan6-Aug-12 21:02 
GeneralRe: Error: Text' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException' Pin
taibc6-Aug-12 21:06
taibc6-Aug-12 21:06 
GeneralRe: Error: Text' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException' Pin
Richard MacCutchan6-Aug-12 22:41
mveRichard MacCutchan6-Aug-12 22:41 
AnswerRe: Error: Text' threw an exception of type 'Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException' Pin
Bernhard Hiller6-Aug-12 21:11
Bernhard Hiller6-Aug-12 21:11 
Questionusing std vector Pin
Xarzu6-Aug-12 6:46
Xarzu6-Aug-12 6:46 
AnswerRe: using std vector Pin
Pete O'Hanlon6-Aug-12 6:48
mvePete O'Hanlon6-Aug-12 6:48 
AnswerRe: using std vector Pin
Wes Aday6-Aug-12 6:50
professionalWes Aday6-Aug-12 6:50 
AnswerRe: using std vector Pin
Christian Amado6-Aug-12 10:20
professionalChristian Amado6-Aug-12 10:20 
Questioncreate a button in C# Pin
ArtGen6-Aug-12 4:53
ArtGen6-Aug-12 4:53 
AnswerRe: create a button in C# Pin
Wes Aday6-Aug-12 4:57
professionalWes Aday6-Aug-12 4:57 
AnswerRe: create a button in C# Pin
Eddy Vluggen6-Aug-12 4:58
professionalEddy Vluggen6-Aug-12 4:58 
QuestionDS file open Pin
birolcoskun6-Aug-12 3:24
birolcoskun6-Aug-12 3:24 
AnswerRe: DS file open Pin
Pete O'Hanlon6-Aug-12 3:38
mvePete O'Hanlon6-Aug-12 3:38 
QuestionCommunicate with USB dongle Pin
vikki02866-Aug-12 1:38
vikki02866-Aug-12 1:38 
GeneralRe: Communicate with USB dongle Pin
Wes Aday6-Aug-12 1:51
professionalWes Aday6-Aug-12 1:51 
GeneralRe: Communicate with USB dongle Pin
vikki02866-Aug-12 2:16
vikki02866-Aug-12 2:16 
GeneralRe: Communicate with USB dongle Pin
Wes Aday6-Aug-12 2:27
professionalWes Aday6-Aug-12 2:27 

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.