TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
toanhoi bui
NA
70
207.1k
Delay in program with RS232
Mar 1 2011 12:10 PM
Hello everybody, I have a problem when recieve data to Com Port with RS232 communication . When I recieve data to Com port I must delay to conect to Database and process it . But I return to receive next the data , this data is lost data .Example my data transmit to PC is "1234567" . The first time , my data is recieved "1234567" .After , this data is processed and the second my data is recieved "234567" or "34567" .I don't understand? Can you help me,please .This is my code
using System.IO.Ports;
using System.Threading;
public partial class Form1 : DevComponents.DotNetBar.Office2007RibbonForm
{
SerialPort serialPort = new SerialPort();
public string data;
public Form1()
{
InitializeComponent();
serialPort.DataReceived+=new SerialDataReceivedEventHandler(serialPort_DataReceived);
}
void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
data = serialPort.ReadExisting();
//textBoxX5.Text = "";
Thread t = new Thread(new ThreadStart(this.RunThread));
t.Start();
}
public string datare;
void Settext(string str)
{
datare += str;
textBoxX9.Text = datare;
datare = "";
}
public delegate void delSettext(string str);
void RunThread()
{
delSettext func = new delSettext(this.Settext);
this.Invoke(func, new Object[1] { data });
}
Reply
Answers (
1
)
what is Abstract class and Interface and where exactly should use?
How to move this process signal?