5 Replies - 1376 Views - Last Post: 13 March 2012 - 06:57 AM Rate Topic: -----

#1 Sathya.asn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 12-December 11

vb code using com1 port

Posted 13 March 2012 - 04:17 AM

actually this is not an vb.net code

it belongs to vb..

i have written it for getting the data from com port 1.

but i dont know what data the com port is getting..

so u genius ...suggest me.. what it is returning.

Dim Lng As Long
Dim lpPoint As POINTAPI
Dim X, Y As Long
Dim vl As Integer
Dim sInput, Disp As String

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command1.SetFocus
  Disp = Command1.Caption
End Sub

Private Sub Command10_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command10.SetFocus
 Disp = Command10.Caption
End Sub
Private Sub Command11_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command11.SetFocus
 Disp = Command11.Caption
End Sub
Private Sub Command12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command12.SetFocus
  Disp = Command12.Caption
End Sub

Private Sub Command13_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command13.SetFocus
  Disp = Command13.Caption
End Sub

Private Sub Command14_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command14.SetFocus
  Disp = Command14.Caption
End Sub

Private Sub Command15_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Command15.SetFocus
  Disp = Command15.Caption
End Sub

Private Sub Command16_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command16.SetFocus
  Disp = Command16.Caption
End Sub

Private Sub Command17_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command17.SetFocus
  Disp = Command17.Caption
End Sub

Private Sub Command18_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command18.SetFocus
 Disp = Command18.Caption
End Sub

Private Sub Command19_Click()
 GetCursorPos lpPoint
 MsgBox lpPoint.X & "," & lpPoint.Y
End Sub

Private Sub Command19_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command19.SetFocus
  Disp = Command19.Caption
End Sub

Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command2.SetFocus
  Disp = Command2.Caption
End Sub

Private Sub Command20_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command20.SetFocus
  Disp = Command20.Caption
End Sub

Private Sub Command21_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Command21.SetFocus
  Disp = Command21.Caption
End Sub

Private Sub Command22_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command22.SetFocus
  Disp = Command22.Caption
End Sub

Private Sub Command23_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command23.SetFocus
 Disp = Command23.Caption
End Sub

Private Sub Command24_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command24.SetFocus
  Disp = Command24.Caption
End Sub

Private Sub Command25_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command25.SetFocus
  Disp = Command25.Caption
End Sub

Private Sub Command26_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command26.SetFocus
  Disp = Command26.Caption
End Sub

Private Sub Command27_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command27.SetFocus
 Disp = Space(3)
End Sub

Private Sub Command28_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command28.SetFocus
 Disp = Command28.Caption
 GetCursorPos lpPoint
 Text1.Text = lpPoint.X + 45
  Text2.Text = lpPoint.Y
End Sub

Private Sub Command29_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command29.SetFocus
 Disp = Command29.Caption
End Sub

Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command3.SetFocus
 Disp = Command3.Caption
End Sub

Private Sub Command30_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command30.SetFocus
 Disp = Command30.Caption
End Sub

Private Sub Command31_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command31.SetFocus
 Disp = Command31.Caption
End Sub

Private Sub Command32_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command32.SetFocus
 Disp = Command32.Caption
End Sub

Private Sub Command33_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command33.SetFocus
 Disp = Command33.Caption
End Sub

Private Sub Command34_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command34.SetFocus
 Disp = Command34.Caption
End Sub

Private Sub Command35_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command35.SetFocus
 Disp = Command35.Caption
End Sub

Private Sub Command37_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command37.SetFocus
 Disp = Command37.Caption
End Sub

Private Sub Command38_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command39.SetFocus
 Disp = Command39.Caption
End Sub

Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command4.SetFocus
  Disp = Command4.Caption
End Sub

Private Sub Command40_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command40.SetFocus
 Disp = Command40.Caption
End Sub

Private Sub Command41_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command41.SetFocus
 Disp = Command41.Caption
End Sub

Private Sub Command42_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command42.SetFocus
 Disp = Command42.Caption
End Sub

Private Sub Command43_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command43.SetFocus
 Disp = Command43.Caption
End Sub

Private Sub Command44_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command44.SetFocus
 Disp = Command44.Caption
End Sub

Private Sub Command45_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command45.SetFocus
 Disp = Command45.Caption
End Sub

Private Sub Command46_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command46.SetFocus
 Disp = Command46.Caption
End Sub

Private Sub Command47_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command47.SetFocus
 Disp = Command47.Caption
End Sub

Private Sub Command48_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command48.SetFocus
 Disp = Command48.Caption
End Sub

Private Sub Command49_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command49.SetFocus
 Disp = Command49.Caption
End Sub

Private Sub Command5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command5.SetFocus
  Disp = Command5.Caption
End Sub

Private Sub Command50_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command50.SetFocus
 Disp = Command50.Caption
End Sub

Private Sub Command51_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command51.SetFocus
 Disp = Command51.Caption
End Sub

Private Sub Command52_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command52.SetFocus
 Disp = Command52.Caption
End Sub

Private Sub Command53_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command53.SetFocus
 Disp = Command53.Caption
End Sub

Private Sub Command54_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command54.SetFocus
 Disp = Command54.Caption
End Sub

Private Sub Command55_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command55.SetFocus
 Disp = Command55.Caption
End Sub

Private Sub Command56_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command56.SetFocus
 Disp = Command56.Caption
End Sub

Private Sub Command57_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command57.SetFocus
 Disp = Command57.Caption
End Sub
 
Private Sub Command58_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command58.SetFocus
 Disp = Command58.Caption
End Sub

Private Sub Command59_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command59.SetFocus
 Disp = Command59.Caption
End Sub

Private Sub Command6_Click()
 'GetCursorPos lpPoint
 'MsgBox lpPoint.X & "," & lpPoint.Y
End Sub
Private Sub Command6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' If sInput = "C" Then
 ' Label2.Caption = Label2.Caption & Command6.Caption
 'End If
  Command6.SetFocus
  Disp = Command6.Caption
End Sub

Private Sub Command60_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command60.SetFocus
 Disp = Command60.Caption
End Sub

Private Sub Command61_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command61.SetFocus
 Disp = Command61.Caption
End Sub

Private Sub Command62_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command62.SetFocus
 Disp = Command62.Caption
End Sub

Private Sub Command63_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command63.SetFocus
 Disp = Command63.Caption
End Sub

Private Sub Command64_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command64.SetFocus
 Disp = Command64.Caption
End Sub

Private Sub Command65_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command65.SetFocus
 Disp = Command65.Caption
End Sub

Private Sub Command66_Click()
 Command1.Caption = "A"
 Command2.Caption = "B"
 Command3.Caption = "C"
 Command4.Caption = "D"
 Command5.Caption = "E"
 Command6.Caption = "F"
 Command7.Caption = "G"
 Command8.Caption = "H"
 Command9.Caption = "I"
 Command10.Caption = "J"
 Command11.Caption = "K"
 Command12.Caption = "L"
 Command13.Caption = "M"
 Command14.Caption = "N"
 Command15.Caption = "O"
 Command16.Caption = "P"
 Command17.Caption = "Q"
 Command18.Caption = "R"
 Command19.Caption = "S"
 Command20.Caption = "T"
 Command21.Caption = "U"
 Command22.Caption = "V"
 Command23.Caption = "W"
 Command24.Caption = "X"
 Command25.Caption = "Y"
 Command26.Caption = "Z"
 
End Sub

Private Sub Command67_Click()
 Command1.Caption = "a"
 Command2.Caption = "b"
 Command3.Caption = "c"
 Command4.Caption = "d"
 Command5.Caption = "e"
 Command6.Caption = "f"
 Command7.Caption = "g"
 Command8.Caption = "h"
 Command9.Caption = "i"
 Command10.Caption = "j"
 Command11.Caption = "k"
 Command12.Caption = "l"
 Command13.Caption = "m"
 Command14.Caption = "n"
 Command15.Caption = "o"
 Command16.Caption = "p"
 Command17.Caption = "q"
 Command18.Caption = "r"
 Command19.Caption = "s"
 Command20.Caption = "t"
 Command21.Caption = "u"
 Command22.Caption = "v"
 Command23.Caption = "w"
 Command24.Caption = "x"
 Command25.Caption = "y"
 Command26.Caption = "z"

End Sub

Private Sub Command68_Click()
 Unload Me
End Sub

Private Sub Command7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command7.SetFocus
 Disp = Command7.Caption
End Sub
Private Sub Command8_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command8.SetFocus
 Disp = Command8.Caption
End Sub
Private Sub Command9_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Command9.SetFocus
 Disp = Command9.Caption
End Sub
Private Sub Form_Activate()
 SetCursorPos 50, 78
End Sub

Private Sub Form_Load()
 On Error Resume Next
 adoCon.CursorLocation = adUseClient
 Set AdoRsport = New ADODB.Recordset
 Set RsClass = New ADODB.Recordset
 OpenDBConnection
 AdoRsport.Open "Select *from Port", adoCon, adOpenDynamic, adLockBatchOptimistic
 MSComm1.CommPort = Val(AdoRsport(0))
 MSComm1.Settings = Val(AdoRsport(1))
 MSComm1.RThreshold = 1
 MSComm1.InputMode = comInputModeText
 MSComm1.PortOpen = True
 adoCon.Close
 MSComm1.PortOpen = True
End Sub

Private Sub MSComm1_OnComm()
 Dim ByteRev() As Byte
 Dim buffer As Variant
 Dim lnt, Panord As Integer
 
 If MSComm1.CommEvent = comEvReceive Then
  buffer = MSComm1.Input
  ByteRev = buffer
 If UBound(ByteRev) > 0 Then
   aa = (ByteRev(i))
  sInput = Chr(Trim(aa))
  GetCursorPos lpPoint
  If sInput = "A" Then
   SetCursorPos lpPoint.X + 45, lpPoint.Y
   If lpPoint.X > 900 Then
    SetCursorPos 41, 122
   End If
  End If
  If sInput = "B" Then
   SetCursorPos lpPoint.X - 45, lpPoint.Y
   If lpPoint.X <= 125 Then
    SetCursorPos 844, 78
   End If
  End If
 If sInput = "C" Then
   Label2.Caption = Label2.Caption & Disp
 End If
 ' MsgBox lpPoint.X, lpPoint.Y

 End If
End If
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: vb code using com1 port

#2 Sathya.asn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 12-December 11

Re: vb code using com1 port

Posted 13 March 2012 - 04:29 AM

actually i have written a code for getting an input from com port 1

but i dont know what data is returned from com port 1?

here i have attached the vb project file..

so look in to and reply me..


OPEN THE ATTACHMENT FILE

EXPLAIN ME WHAT THE FUNCTION

Private Sub MSComm1_OnComm()

IS DOING???

Attached File(s)

  • Attached File  JJ.zip (26.63K)
    Number of downloads: 43

Was This Post Helpful? 0
  • +
  • -

#3 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: vb code using com1 port

Posted 13 March 2012 - 04:50 AM

wow easy on the font dude. i guess your using vb6 not vb.net (i cant remember if there is OnComm event in vb.net) how ever OnComm event is triggered when you recieve data from commport. so in the oncomm event you read the data from the device.
Was This Post Helpful? 0
  • +
  • -

#4 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 205
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: vb code using com1 port

Posted 13 March 2012 - 05:20 AM

I don't like the tone of this guy!
Was This Post Helpful? 0
  • +
  • -

#5 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,776
  • Joined: 26-March 09

Re: vb code using com1 port

Posted 13 March 2012 - 05:43 AM

If you have written the code, how about you explain to us what it's doing or what you expect it to be doing.

What problem have you got with it?
Was This Post Helpful? 0
  • +
  • -

#6 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: vb code using com1 port

Posted 13 March 2012 - 06:57 AM

Sathya, I don't open attached files and go through them for people. Especially zip files, project files, and the like. It takes a good deal more time to get to the problem, and usually it means that someone has just regurgitated their entire code base into a file and wants us to clean it up. Better to post the RELEVANT code here, meaning leave out the IRRELEVANT code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1