mscomm event breaker
mscomm event breaker
mscomm event breaker
mscomm event breaker
mscomm event breaker
mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker
mscomm event breaker mscomm event breaker
mscomm event breaker
Go Back  Xtreme Visual Basic Talk > > > mscomm event breaker


Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2008, 03:08 AM
adriangpc adriangpc is offline
Newcomer
 
Join Date: May 2008
Posts: 2
Default mscomm event breaker


hi, I use the mscomm to control the serial port because I can't seem to get the serial port in the Vb 2005. How do I break from an oncomm event of mscomm? for example i put an if statement inside the event and if that condition is satisfied, the oncomm event is stopped and the other codes below it is not executed anymore. How do I do that? Thanks.
Reply With Quote
  #2  
Old 05-09-2008, 09:19 AM
MKoslof's Avatar
MKoslofmscomm event breaker MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

While I won't recommend using MSCOMM or the old legacy VB com component in your VB.net application, if you have already started the app, I'm not going to recommend starting over. Can you show us your code? And what do you mean the code below the IF statement isn't executing? Most likely an unhandled exception is occuring or something else which short circuits the code. Note, the return is in ascii so if you are assigning it to some control value you need to parse it (but I'm just assuming since we haven't seen your code). I'm a C# nerd, but a VB.net/Legacy look and feel example (since you are using the COM control) would be similar to:

Code:
If Me.Comm1.CommEvent = MSCommLib.OnCommConstants.comEvReceive Then
  theTextBot.Text +=Asc(Me.Comm1.Input)
End If
You do realize if you have else ifs or else obviously those won't run, since each event is hitting your code and doing its own evaluation. If you are sure you are trapping the right type in your code and there are no errors being thrown we would need to see your code to be of more assistance
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
mscomm event breaker
mscomm event breaker
mscomm event breaker mscomm event breaker
mscomm event breaker
mscomm event breaker
mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker mscomm event breaker
mscomm event breaker
mscomm event breaker
 
mscomm event breaker
mscomm event breaker
 
-->