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
Suraj Binorkar
NA
149
7.2k
Serial Port Communication problem
Aug 6 2016 5:16 AM
Hi,<br />I am facing issue with the serial port communication issue, actually it was working till yesterday but now its giving me error, you can see the code in below. Actually the error is generating during calling method.<br /><br /><div id="pastingspan1">this.serialPort1 = new SerialPort("port1", 9600, Parity.None, 8, StopBits.One);</div><div id="pastingspan1"> if (!this.serialPort1.IsOpen)</div><div id="pastingspan1"> {</div><div id="pastingspan1"> this.serialPort1.Open();</div><div id="pastingspan1"> this.serialPort1.DataReceived += new <strong>SerialDataReceivedEventHandler(this.scannerSerialPort_DataReceived);</strong></div><div id="pastingspan1"> }</div><div> </div><div>The method you can see in below :-<br /><br /><div id="pastingspan1">public void scannerSerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)</div><div id="pastingspan1"> {</div><div id="pastingspan1"> frmRegistrationStickerPrinting _frmRegistrationStickerPrinting = this;</div><div id="pastingspan1"> _frmRegistrationStickerPrinting.scan = string.Concat(_frmRegistrationStickerPrinting.scan, this.serialPort1.ReadExisting());</div><div id="pastingspan1"> if (this.scan.EndsWith("\r\n"))</div><div id="pastingspan1"> {</div><div id="pastingspan1"> this.scan = this.scan.Substring(0, this.scan.Length - 2);</div><div id="pastingspan1"> Control activeControl = base.ActiveControl;</div><div id="pastingspan1"> if (activeControl.InvokeRequired)</div><div id="pastingspan1"> {</div><div id="pastingspan1"> activeControl.Invoke(new MethodInvoker(() => activeControl.Text = this.scan));</div><div id="pastingspan1"> }</div><div id="pastingspan1"> Control nextControl = base.GetNextControl(activeControl, true);</div><div id="pastingspan1"> if (nextControl.InvokeRequired)</div><div id="pastingspan1"> {</div><div id="pastingspan1"> nextControl.Invoke(new MethodInvoker(() => nextControl.Focus()));</div><div id="pastingspan1"> }</div><div id="pastingspan1"> this.scan = "";</div><div id="pastingspan1"> }</div><div id="pastingspan1"> }</div></div><br /><br /><br />
Reply
Answers (
2
)
facebookapi in c#
How to create and get img og EAN13 barcode in c#