|
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:
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();
System.Threading.Thread t = new System.Threading.Thread(() =>
{
ConvertFiles(sourceFile, destinationFile);
});
t.Start();
}
private void ConvertFiles(string src, string dest)
{
}
Are there anyone know how to fix it ?
Thanks and regards,
|
|
|
|
|
You cannot access GUI components from secondary threads in C#. There are many articles available which discuss this issue, see these samples[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thank you.
But I used "Invoke" when I want to access controls as my code.
|
|
|
|
|
Yes, but the code you showed in your question has nothing to do with the error that you are reporting.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
It is txtAddress which was accessed from a different thread, not pixLoadingIcon . That code is not shown in the snippet above. Wrap that also with an InvokeRequired .
|
|
|
|
|
I have got the following in a header file for a class:
#include <vector>
#include <math.h>
In the class description, I have the following protected member:
vector<Point2D> samples;
Point2D is defined as a class
during compile time I get lots of errors (C2143, C4430 and C2238)
Any ideas?
|
|
|
|
|
I'm not surprised you get errors. That's C++ and this is the C# forum. If you're trying this in C#, it'll give you errors up the wazzoo.
|
|
|
|
|
Xarzu wrote: Any ideas
Posting in the appropriate forum would be a good idea.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Try it on C++ forum.
May be more experienced users can help you.
Christian Amado
MCITP | MCTS | MOS | MTA
Olimpia ☆ ★★★
Please mark as answer, if it helps.
|
|
|
|
|
i have a textbox and a search button.
When I populate (with data that i have in db) the textbox and press the search button I want to populated other textbox (with data that i have in db) who are only edited.
please help me .thnx
|
|
|
|
|
ArtGen wrote: help me
Okay.... do you really think that anyone reading your post could figure out what it is that you are trying to do? What does "Create a button" and getting data from your database have to do with one another? What database? What have you tried? What is the problem that you are having? What does "who are only edited" mean?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
ArtGen wrote: who are only edited.
Edited by whom, in which period?
You'll need to rethink and clarify your question, as it stands now I'm inclined to explain how to create a button and go from there.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
. Ds How do I open the file extension?
(Note : ds twain data source file.)
Regards
|
|
|
|
|
Possibly the easiest way for you would be to use this[^] library to take the heavy work out of parsing the TWAIN formats.
|
|
|
|
|
i have an application,i will communicate with his application using USB donbgle,and user need to enter the COM port for the USB that is being used in the PC,how can i access and communicate with usb using c#
Thanks
|
|
|
|
|
vikki0286 wrote: COM port
There is your answer... use the SerialPort class.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Please would you explain how i can detect and communicate with USB using serial port class?
Thanks
|
|
|
|
|
Reading the documentation[^] is a real good place to start.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
my requirement is i will connect a USB with my PC,USB connect with a base station and will get the Athletes hit details from the base station,then i will get the data from the USB and enter the return info by USB in my SQL database.
i read this code,it will simply open the specific port,
please can you explain more how i can check my port is connected with USB dongle or not.
if my port is connected with USB dongle then how i will communicate the USB?
what command i need to send to get data from the USB?
In what format i will get the data from the USB dongle.
Thanks alot.
|
|
|
|
|
vikki0286 wrote: what command i need to send to get data from the USB
Out of the thousands of dongles that there are, how on earth would I know which one you are using? Read the documentation for the dongle. If you can't figure it out then ask the manufacturer. They have support people and supporting their product is what they are paid to do.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
It looks like a standard Comm port: 115.2KB, N,8,1.
We have a specific wireless protocol which defines the communication packets across the port.
In general, however, the communication is ASCII encoded HEX ending in a CR/LF pair.
The general packet structure is:
Packet Structure (TBD bytes maximum)
ll pp dd dd dd ss ss ss nn bb bb ....... bb ir
|| || || || || || || || || || || ||
|| || || || || || || || || || || xx-- Transaction ID (i:Packet ID [0h-Fh]; r:Retry Count [0h-Fh])
|| || || || || || || || || || || (00 for PC-->USB part of PC-->USB-->Remote communication;
|| || || || || || || || || || || (not sent/used for PC-->USB or USB-->PC Only communication)
|| || || || || || || || || xx-xx-.......-xx----- Data Bytes [0-TBDd]
|| || || || || || || || xx---------------------- Command/Data (see Commands below)
|| || || || || xx xx xx------------------------- Source ID [000001h-FFFFFFh]
|| || xx xx xx---------------------------------- Destination ID [000001h-FFFFFFh, 000000h:broadcast]
|| xx------------------------------------------- Project ID [00h-FFh]
xx---------------------------------------------- Packet Length-1 [08h-FFh]
And, as an example, the packet received for an event burst is:
9A{*B0 or *B1} - Report ‘Event’ Burst
CD 00 dd dd dd ss ss ss 9A tt tt tt tt xx(0) yy(0) zz(0)..xx(63) yy(63) zz(63) ir
- tt tt tt tt: event time stamp (see Firmware Notes)
- xx(n) yy(n) zz(n): 2’s comp. 8-bit acceleration array data
- Response {9A} is sent each time an 'Event' is detected.
how can i do get and send data to com port using Serial port class.
Thanks
|
|
|
|
|
Nobody is going to write the code for you. Read the documentation.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
yes i know no body can do for me.i just want to get idea.because i am doing work first time with com port.
i got the code to connect with Com Port,i can connect with COM PORT using Serials port class.
i would like to know one thing, how can i run the commands on the com port
to send and retrieve data.
Thanks
Vikas
|
|
|
|
|
I want to access usb printer details using snmp. But i am not able to connect it through c#.net. How can i connect my c# app to usb printer?
|
|
|
|
|
You might try reading through this[^] and see if that helps.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|