Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

What different in run program with VS2008 and run program with exe?

$
0
0

Sorry my english is not well,but I try my best to explain the problem.

I use BackgroundWorker control SerialPort to read and write data.

When I use VS 2008 to run the program, everything is fine,

but, if run excution file(.exe), the program is no response.

How to fix the problem?

/* BackgroundWorker DoWork event */
this.Invoke(this.delegateOutputLaserStatus, new object[] { "ProgramID " + lSubProgramID + " SN transmit.." });

//  use SerialPort send command
mLaserControl.changeSN(LaserControl.mProgramID, Int32.Parse(lSubProgramID), pSN);

// wait SerialPort get all response
while (!mLaserControl.mGetData) { }

// reset Flag to false
mLaserControl.mGetData = false;
mLaserControl.mReturnData = "";/* SerialPort DataReceive event */
byte[] lReadData = new byte[lBytesToRead]; 

// read data
mLaserSerialPort.Read(lReadData, 0, lBytesToRead);
mReturnData += Encoding.ASCII.GetString(lReadData);

// if not end byte then return
if (lReadData[lBytesToRead - 1] != mSeperateCommand[0])
return;

//  set Flag to true when read all data
if (mReadData != "")
{
mGetData = true;
}


Viewing all articles
Browse latest Browse all 31927

Trending Articles