Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Function is used to open comm port
Author:
neeraj
E-mail:
Click to e-mail author
Submitted:
7/19/2009
Version:
VB6
Compatibility:
VB6
Category:
Miscellaneous
Views:
11261
This function is used to open comm port and setting the desired baud rate. There are two global variables port no and baud rate, which are set by user from the combo boxes .
Declarations:
'none
Code:
Public Function Open_Comm_Port() As Boolean On Error GoTo ErrorMessage With MSComm .CommPort = port_no .Settings = baud_rate & ",n,8,1" .Handshaking = comNone .InputMode = comInputModeBinary .DTREnable = True If .PortOpen = False Then .PortOpen = True End If End With ErrorMessage: If Err.Number = 8002 Then lbl_communication.Caption = "Invalid Port Number, Please try again" Open_Comm_Port = False Exit Function ElseIf (Err.Number = 8005) Then lbl_communication.Caption = "Port is already open or busy" Open_Comm_Port = False Exit Function End If Open_Comm_Port = True End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement