Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 107,162 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,351 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Visual basic serial communication

 
Reply to this topicStart new topic

Visual basic serial communication, i want to read data from serial port and store into ms access and agai

rupeshtsawant
post 4 Aug, 2008 - 02:53 AM
Post #1


New D.I.C Head

*
Joined: 3 Aug, 2008
Posts: 3

im rs1, rs2, rs3, rs4, rs5, rs6, rs7, rs8 As String

Dim rs(8), temp As String

Dim flag, i As Variant

Private Sub Command1_Click()
MSComm1.PortOpen = False
'Close #1
End Sub

Private Sub Command3_Click()

'Open "c:\file.txt" For Input As #1

'Text1.Text = Input$(1, #1)

'Close #1
End Sub

Private Sub Form_Load()

With MSComm1
.CommPort = 1
.Handshaking = 0 - comNone
.RThreshold = 1
.RTSEnable = True
.Settings = "19200,n,8,2"
.SThreshold = 1
.InputMode = 0 - comInputModeText
.PortOpen = True
.InputLen = 1
End With
'Open "c:\file.txt" For Output As #1


End Sub

Private Sub MSComm1_OnComm()
error:
Select Case MSComm1.CommEvent
Case comEventBreak
Case comEventCDTO
Case comEventCTSTO
Case comEventDSRTO
Case comEventFrame
Case comEventOverrun
Case comEventRxOver
Case comEventRxParity
Case comEventTxFull
Case comEventDCB
Case comEvCD
Case comEvCTS
Case comEvDSR
Case comEvRing
Case comEvReceive
Case comEvSend
Case comEvEOF
End Select

On Error GoTo error

MSComm1.InputMode = comInputModeText

MSComm1.NullDiscard = True


For i = 1 To 8
rs(i) = MSComm1.Input
'Print rs(i)
Print rs(i)

If rs(i) = " " Then
MsgBox "empty"
End If

Next i
temp = Join(rs)
MsgBox temp

If i = 9 Then
MSComm1.PortOpen = False
Exit Sub
End If

'rs1 = Right(rs, 1)
'rs2 = Left(Right(rs, 2), 1)
'rs3 = Left(Right(rs, 3), 1)
'rs4 = Left(Right(rs, 4), 1)
'rs5 = Left(Right(rs, 5), 1)
'rs6 = Left(Right(rs, 6), 1)
'rs7 = Left(Right(rs, 7), 1)
'rs8 = Left(Right(rs, 8), 1)

'Print rs
'Print rs1
'Print rs2
'Print rs3
'Print rs4
'Print rs5
'Print rs6
'Print rs7
'Print rs8
'Print #1, rs

'Print rs

End Sub
User is offlineProfile CardPM

Go to the top of the page


dineeshd
post 4 Aug, 2008 - 03:31 AM
Post #2


D.I.C Regular

Group Icon
Joined: 30 Jun, 2008
Posts: 306



Thanked 11 times

Dream Kudos: 550
My Contributions


Caffeine Lounge is not a forum for programming questions, you should post it in Visual Basic Forum



This post has been edited by dineeshd: 4 Aug, 2008 - 04:16 AM
User is offlineProfile CardPM

Go to the top of the page

fooboo
post 4 Aug, 2008 - 04:03 AM
Post #3


The king of Nynex

Group Icon
Joined: 28 Jul, 2006
Posts: 2,402



Dream Kudos: 150
My Contributions


Lol...If only there was an obvious link the the right forum for this...OH HANG ON! There is numb nuts.
User is offlineProfile CardPM

Go to the top of the page

dineeshd
post 4 Aug, 2008 - 04:18 AM
Post #4


D.I.C Regular

Group Icon
Joined: 30 Jun, 2008
Posts: 306



Thanked 11 times

Dream Kudos: 550
My Contributions


QUOTE(fooboo @ 4 Aug, 2008 - 04:33 PM) *

Lol...If only there was an obvious link the the right forum for this...OH HANG ON! There is numb nuts.


Sorry for that. I have fixed it now... biggrin.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/27/08 09:24PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month