Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: Uninstalling (setup and d eployment project) - newbie question Pin
choo_chu30-Jun-09 11:22
choo_chu30-Jun-09 11:22 
GeneralRe: Uninstalling (setup and d eployment project) - newbie question Pin
Jimmanuel30-Jun-09 11:27
Jimmanuel30-Jun-09 11:27 
Questionoverriding System.Diagnostics..::.DebuggerStepThroughAttribute Pin
Dan Neely30-Jun-09 8:45
Dan Neely30-Jun-09 8:45 
AnswerRe: overriding System.Diagnostics..::.DebuggerStepThroughAttribute Pin
Rob Smiley30-Jun-09 11:43
Rob Smiley30-Jun-09 11:43 
GeneralRe: overriding System.Diagnostics..::.DebuggerStepThroughAttribute Pin
Dan Neely1-Jul-09 2:13
Dan Neely1-Jul-09 2:13 
Questionserial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Arpita Patel30-Jun-09 6:52
Arpita Patel30-Jun-09 6:52 
AnswerRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
monstale30-Jun-09 7:08
monstale30-Jun-09 7:08 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Arpita Patel30-Jun-09 9:31
Arpita Patel30-Jun-09 9:31 
I used this code for sending the data

private void SendData()
{
if (CurrentDataMode == DataMode.Text)
{
// Send the user's text straight out the port
comport.Write(txtSendData.Text);

// Show in the terminal window the user's text
Log(LogMsgType.Outgoing, txtSendData.Text + "\n");

}
else
{
try
{
// Convert the user's string of hex digits (ex: B4 CA E2) to a byte array
byte[] data = HexStringToByteArray(txtSendData.Text);

// Send the binary data out the port
comport.Write(data, 0, data.Length);

// Show the hex digits on in the terminal window
Log(LogMsgType.Outgoing, ByteArrayToHexString(data) + "\n");
}
catch (FormatException)
{
// Inform the user if the hex string was not properly formatted
Log(LogMsgType.Error, "Not properly formatted hex string: " + txtSendData.Text + "\n");
}
}
txtSendData.SelectAll();
}

For the Recieving purpose I used

private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
// This method will be called when there is data waiting in the port's buffer

// Determain which mode (string or binary) the user is in
if (CurrentDataMode == DataMode.Text)
{
// Read all the data waiting in the buffer
string data = comport.ReadExisting();


// Display the text to the user in the terminal
Log(LogMsgType.Incoming, data);
}
else
{
// Obtain the number of bytes waiting in the port's buffer
int bytes = comport.BytesToRead;

// Create a byte array buffer to hold the incoming data
byte[] buffer = new byte[bytes];

// Read the data from the port and store it in our buffer
comport.Read(buffer, 0, bytes);

// Show the user the incoming data in hex format
Log(LogMsgType.Incoming, ByteArrayToHexString(buffer));
}
}

now give me appropriate answer for my question.
thanks a lot fro replying me.

Arpita Patel

AnswerRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Jimmanuel30-Jun-09 7:09
Jimmanuel30-Jun-09 7:09 
AnswerRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Luc Pattyn30-Jun-09 7:26
sitebuilderLuc Pattyn30-Jun-09 7:26 
AnswerRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Tr@v1-Jul-09 10:59
Tr@v1-Jul-09 10:59 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Member 647306611-Aug-09 6:00
Member 647306611-Aug-09 6:00 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Member 647306614-Oct-09 5:58
Member 647306614-Oct-09 5:58 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Tr@v14-Oct-09 7:30
Tr@v14-Oct-09 7:30 
GeneralRe: serial port communication between computer and another hardware device via RS232 in C# for windows Application Pin
Member 647306614-Oct-09 11:11
Member 647306614-Oct-09 11:11 
QuestionCustom config sections problem. Pin
Zeokat30-Jun-09 4:48
Zeokat30-Jun-09 4:48 
AnswerRe: Custom config sections problem. Pin
Sk9330-Jun-09 5:10
Sk9330-Jun-09 5:10 
GeneralRe: Custom config sections problem. Pin
Zeokat30-Jun-09 6:12
Zeokat30-Jun-09 6:12 
JokeRe: Custom config sections problem. Pin
Sk9330-Jun-09 6:13
Sk9330-Jun-09 6:13 
QuestionToString() method on objects returned from a webservice (Compact framework) [modified] Pin
c0ax_lx30-Jun-09 4:43
c0ax_lx30-Jun-09 4:43 
AnswerRe: ToString() method on objects returned from a webservice (Compact framework) Pin
SeMartens30-Jun-09 4:52
SeMartens30-Jun-09 4:52 
GeneralRe: ToString() method on objects returned from a webservice (Compact framework) Pin
c0ax_lx30-Jun-09 4:57
c0ax_lx30-Jun-09 4:57 
GeneralRe: ToString() method on objects returned from a webservice (Compact framework) Pin
SeMartens30-Jun-09 5:08
SeMartens30-Jun-09 5:08 
GeneralRe: ToString() method on objects returned from a webservice (Compact framework) Pin
c0ax_lx30-Jun-09 23:14
c0ax_lx30-Jun-09 23:14 
QuestionQuick quest Pin
gwithey30-Jun-09 4:29
gwithey30-Jun-09 4:29 

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.