473,544 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rs-232 Vb6

27 New Member
Sir,

I have my project its a Barcode System, since i dont know yet how to use RS-232, My question is:

1. RS-232 is only for Sending Date and Reading Data? its just for open the MScomm port and Settings.? How can i interface it in VB6 Programming?

Sir,
can you give explanation of these code:

MSComm1.PortOpe n=True
Ms.comm1.Settin gs=9600,n,1,8

Sir is there other code need to enabled Rs-232?

2. Sir can you provide me samples of Barcode system using RS-232 in VB6?


Sir, thank you in advance! and More power

Julius
Nov 13 '06 #1
6 6805
r035198x
13,262 MVP
Sir,

I have my project its a Barcode System, since i dont know yet how to use RS-232, My question is:

1. RS-232 is only for Sending Date and Reading Data? its just for open the MScomm port and Settings.? How can i interface it in VB6 Programming?

Sir,
can you give explanation of these code:

MSComm1.PortOpe n=True
Ms.comm1.Settin gs=9600,n,1,8

Sir is there other code need to enabled Rs-232?

2. Sir can you provide me samples of Barcode system using RS-232 in VB6?


Sir, thank you in advance! and More power

Julius
Hey Julius, Welcome to the scripts. You are posting your posts in the wrong forums.
That first one for example should have been here:
http://www.thescripts.com/forum/forum30.html

And this qusetion is better asked in the vb forum
Nov 13 '06 #2
OldSchool
27 New Member
Hey Julius, Welcome to the scripts. You are posting your posts in the wrong forums.
That first one for example should have been here:
http://www.thescripts.com/forum/forum30.html

And this qusetion is better asked in the vb forum
Thank you sir for informing me.
Julius
Nov 13 '06 #3
OldSchool
27 New Member
Sir,

I have my project its a Barcode System, since i dont know yet how to use RS-232, My question is:

1. RS-232 is only for Sending Date and Reading Data? its just for open the MScomm port and Settings.? How can i interface it in VB6 Programming?

Sir,
can you give explanation of these code:

MSComm1.PortOpe n=True
Ms.comm1.Settin gs=9600,n,1,8

Sir is there other code need to enabled Rs-232?

2. Sir can you provide me samples of Barcode system using RS-232 in VB6?


Sir, thank you in advance! and More power

Julius
Nov 13 '06 #4
r035198x
13,262 MVP
Thank you sir for informing me.
Julius
Welcome. No need for the "sir" next time though.
Nov 13 '06 #5
Hansi65
13 New Member
This worked for me with an serial Metrologic Voyager:

Suppose your MSComm control is named BarcodeComm
Settings are: 9600,n,8,1

Expand|Select|Wrap|Line Numbers
  1. 'in your forms declaration section
  2. Dim WithEvents BarcodeTimer As Timer
  3.  
  4. Initialization somwhere, e.g. in form_Load: 
  5.    BarcodeComm.CommPort = 1
  6.    BarcodeComm.PortOpen = True
  7.    BarcodeTimer.Interval = 100
  8.    BarcodeTimer.Enabled = True
  9.  
  10. 'use a timer to read from the serial port:
  11. Private Sub BarcodeTimer_Timer()
  12.    Dim barcodeRead as String 
  13.    barcodeRead = ReadBarcode()
  14.  
  15.    if barcodeRead <> "" then
  16.       'handling the code read...
  17.        Msgbox "Barcode=" + barcodeRead
  18.    Endif     
  19. End Sub
  20.  
  21. Function ReadBarcode() As String
  22.    On Error GoTo ReadBarcode_ERROR
  23.  
  24.    Static comInput As String
  25.    Static ReadBarcodeRunning As Integer
  26.  
  27.    If ReadBarcodeRunning Then
  28.       ReadBarcode = ""
  29.       Exit Function
  30.    Else
  31.       ReadBarcodeRunning = True
  32.  
  33.       If BarcodeComm.InBufferCount > 0 Or Len(comInput) > 0 Then
  34.          Do
  35.             comInput = comInput + comControl.Input
  36.  
  37.             'if received data contains CR+LF, then exit        
  38.             If InStr(comInput, Chr$(13) + Chr$(10) > 0 Then
  39.                Exit Do
  40.             Else
  41.                dummy = DoEvents()
  42.             End If
  43.          Loop
  44.  
  45.          'remove CR+LF 
  46.          posP = InStr(comInput, Chr$(13) + Chr$(10))
  47.          t$ = Left$(comInput, posP - 1)
  48.  
  49.      'anything beyond CRLF belongs to next barcode    
  50.          comInput = MID$(comInput, posP + 2)
  51.  
  52.          ReadBarcode = t$
  53.       Else
  54.          ReadBarcode = ""
  55.       End If
  56.  
  57.       ReadBarcodeRunning = False
  58.    End If
  59.  
  60. ReadBarcode_EXIT:
  61.    Exit Function
  62.  
  63. ReadBarcode_ERROR:
  64.    MsgBox "Error in ReadBarcode:" + vbcrlf + Error$
  65.    Resume Next
  66. End Function
BEWARE:
make sure that the barcode scanner adds CR+LF as delimiters after each barcode or adjust the delimiter detection in ReadBarcode() accordingly

Let me know if this helped a little...
Nov 15 '06 #6
OldSchool
27 New Member
Thank You Sir, for the Code you gave me... Thanks Again God Bless U...

Julius


This worked for me with an serial Metrologic Voyager:

Suppose your MSComm control is named BarcodeComm
Settings are: 9600,n,8,1

Expand|Select|Wrap|Line Numbers
  1. 'in your forms declaration section
  2. Dim WithEvents BarcodeTimer As Timer
  3.  
  4. Initialization somwhere, e.g. in form_Load: 
  5.    BarcodeComm.CommPort = 1
  6.    BarcodeComm.PortOpen = True
  7.    BarcodeTimer.Interval = 100
  8.    BarcodeTimer.Enabled = True
  9.  
  10. 'use a timer to read from the serial port:
  11. Private Sub BarcodeTimer_Timer()
  12.    Dim barcodeRead as String 
  13.    barcodeRead = ReadBarcode()
  14.  
  15.    if barcodeRead <> "" then
  16.       'handling the code read...
  17.        Msgbox "Barcode=" + barcodeRead
  18.    Endif     
  19. End Sub
  20.  
  21. Function ReadBarcode() As String
  22.    On Error GoTo ReadBarcode_ERROR
  23.  
  24.    Static comInput As String
  25.    Static ReadBarcodeRunning As Integer
  26.  
  27.    If ReadBarcodeRunning Then
  28.       ReadBarcode = ""
  29.       Exit Function
  30.    Else
  31.       ReadBarcodeRunning = True
  32.  
  33.       If BarcodeComm.InBufferCount > 0 Or Len(comInput) > 0 Then
  34.          Do
  35.             comInput = comInput + comControl.Input
  36.  
  37.             'if received data contains CR+LF, then exit        
  38.             If InStr(comInput, Chr$(13) + Chr$(10) > 0 Then
  39.                Exit Do
  40.             Else
  41.                dummy = DoEvents()
  42.             End If
  43.          Loop
  44.  
  45.          'remove CR+LF 
  46.          posP = InStr(comInput, Chr$(13) + Chr$(10))
  47.          t$ = Left$(comInput, posP - 1)
  48.  
  49.      'anything beyond CRLF belongs to next barcode    
  50.          comInput = MID$(comInput, posP + 2)
  51.  
  52.          ReadBarcode = t$
  53.       Else
  54.          ReadBarcode = ""
  55.       End If
  56.  
  57.       ReadBarcodeRunning = False
  58.    End If
  59.  
  60. ReadBarcode_EXIT:
  61.    Exit Function
  62.  
  63. ReadBarcode_ERROR:
  64.    MsgBox "Error in ReadBarcode:" + vbcrlf + Error$
  65.    Resume Next
  66. End Function
BEWARE:
make sure that the barcode scanner adds CR+LF as delimiters after each barcode or adjust the delimiter detection in ReadBarcode() accordingly

Let me know if this helped a little...
Nov 16 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3651
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
2
3600
by: Joseph Markovich | last post by:
I'm having some trouble with VB in Access 2000. I have a form that the user enters in just one number (in this case, it's a base salary) and then the program is going to do a bunch of math (which is not all shown) and populate a table with these new, calculated salary values. I know I shouldn't be storing calculated values in the table, but I...
25
10364
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records for people whose ID is in the list box. I made minor changes to the code (mainly replacing rs.AddNew with rs.Edit)and it appears to be updating...
9
5687
by: Mike | last post by:
I have some simple code see below. I have response written out the query and it is valid and returns values when ran directly against my db, which is Oracle. My OS is Win 2003. My question is I never get to the point of the loop. It always thinks I am at the RS.EOF. Similar code works in other asp pages on the same server. How do I...
12
20622
by: John | last post by:
I can't get my head around this! I have the following code: <% .... Code for connection to the database ... .... Code for retrieving recordset ... If Not rs.EOF Then ... Do something...
0
7361
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7601
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5901
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5289
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4908
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
983
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
654
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.