By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,780 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,780 IT Pros & Developers. It's quick & easy.

How to compare the mscomm data recieved using RFID and Compare it with my Text

P: 27
Sir its me julius,

Sir how can i compare the mscomm data recieved using RFID and Compare it with my Text data.

Sir example.

Private Sub MSComm1_OnComm()

Text1.SetFocus
' STX Data ETX + Cr
Text1.Text = MSComm1.Input
MSInput = Text1.Text
End Sub

How can i compare the recieved Data to TextData ?
Msinput is memory right?
How can i compare the Input in MSinput to Text data and i will display Msgbox "ok you're Passed" after comparing the Data


Hope you will responds
Thanks.

Julius
Nov 20 '06 #1
Share this Question
Share on Google+
6 Replies


100+
P: 267
Sir its me julius,

Sir how can i compare the mscomm data recieved using RFID and Compare it with my Text data.

Sir example.

Private Sub MSComm1_OnComm()

Text1.SetFocus
' STX Data ETX + Cr
Text1.Text = MSComm1.Input
MSInput = Text1.Text
End Sub

How can i compare the recieved Data to TextData ?
Msinput is memory right?
How can i compare the Input in MSinput to Text data and i will display Msgbox "ok you're Passed" after comparing the Data


Hope you will responds
Thanks.

Julius
hi

you could do it like that i suppose
however your mscomm input might be only 1 character
better to create a loop while receiving all data and compare afterwards
such as

Expand|Select|Wrap|Line Numbers
  1.     Do
  2.     DoEvents
  3.     RxTxt = MSComm1.Input
  4.     If Len(RxTxt) > 0 Then strBuffer=strBuffer + RxTxt
  5.     Loop Until RxTxt = Chr(10) 'or whatever character is used to end input string
  6.  
now you can compare strings

Expand|Select|Wrap|Line Numbers
  1. if Text1.text=Buffer then
  2. msgbox "OK, you're passed",vbokOnly+vbExclamation"
  3. endif
  4.  
Nov 20 '06 #2

P: 27
Sir i Highly appreciated your kindness, Sir can you out Comment in the code you given to me if you dont mind sir...


Thanks
Julius
Nov 23 '06 #3

100+
P: 267
Sir i Highly appreciated your kindness, Sir can you out Comment in the code you given to me if you dont mind sir...


Thanks
Julius
first of all julius, there are no sirs here :), thank you.

Do
-- start a loop
DoEvents
-- look if no other thing (keystrokes or whatever occur)
RxTxt = MSComm1.Input
-- name your mscomm input RcTxt
If Len(RxTxt) > 0 Then strBuffer=strBuffer + RxTxt
-- if RxTxt holds data, transfer this to a buffer, called strBuffer
Loop Until RxTxt = Chr(10)
-- if the input meets e.g. chr(10) , the input ends

now you have all your received data in strBuffer and can you start to compare

if Text1.text=Buffer then
-- if the contents of Text1 as the same as what you received (strBuffer)
msgbox "OK, you're passed",vbokOnly+vbExclamation"
-- show a messagebox that you're passed.
endif
-- otherwise do nothing
Nov 23 '06 #4

P: 27
Thanks!

Big help to me. coz as of now im just a beginner in vb. thanks for the support.

From where country you are if you dont mind?

Julius

first of all julius, there are no sirs here :), thank you.

Do
-- start a loop
DoEvents
-- look if no other thing (keystrokes or whatever occur)
RxTxt = MSComm1.Input
-- name your mscomm input RcTxt
If Len(RxTxt) > 0 Then strBuffer=strBuffer + RxTxt
-- if RxTxt holds data, transfer this to a buffer, called strBuffer
Loop Until RxTxt = Chr(10)
-- if the input meets e.g. chr(10) , the input ends

now you have all your received data in strBuffer and can you start to compare

if Text1.text=Buffer then
-- if the contents of Text1 as the same as what you received (strBuffer)
msgbox "OK, you're passed",vbokOnly+vbExclamation"
-- show a messagebox that you're passed.
endif
-- otherwise do nothing
Nov 23 '06 #5

100+
P: 267
Thanks!

Big help to me. coz as of now im just a beginner in vb. thanks for the support.

From where country you are if you dont mind?

Julius
just click my 'picture' to see the profile
by the way, learning VB is just open any program, read and try to understand what others have done.
it takes a while .... :(
Nov 23 '06 #6

P: 1
Hi Julius,
What happened to your project. I am actually working on the same project than you. VB with RFID and reception on a serial port. If you don't mind sending me your project, it would be great.
My e-mail address is khalilche@hotmail.com and I would appreciate it too much if you help me in my project by sending me your code.
Thanks
May 11 '07 #7

Post your reply

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