Read information from magnetic card reader and display in various textboxes | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | |
Hi everyone
I am working on a project and have to connect mx3-usb magnetic card reader with buildin software installation facility. I want to collect customer information by their driving licence. When I scan a card it display all information in one text box that looks like this
%bcsurrey^asif, farhana^bsmt-16568 90a ave$surrey bc v6v 2p1^?
;6360283892537=080819801006=?
I extracted user's licence number by using L and R trim function. My target is to extract and display all fields in their rexpective fields leaving unnecessary fields.I don't think that using trim function to seperate these fields is right choice.
I can't find any example about it. can someone help me do this? is there any ActiveX control or function to do that.
any idea help will be greatly appreciated.
thanks
|  | Moderator | | Join Date: Dec 2006 Location: Bangalore ,India
Posts: 7,508
| | | re: Read information from magnetic card reader and display in various textboxes
As you have posted a question in the articles section it is being moved to Visual Basic Forum
MODERATOR
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes
Use the Split() function.
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by Killer42 Use the Split() function. thnaks killer
but there are more than one filter string in the given string. What I should about it. Does filter support this?
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 there are more than one filter string in the given string. What I should about it. Does filter support this? Can you tell us in detail what the format is? For instance, is "^" the delimiter between pieces of information, or what?
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
%bcsurrey^asif, farhana^bsmt-12728 96a ave$surrey bc v3v 2a1^?
;6360287293137=080819821106=?
where
b/w
bcsurrey issuing authority length not fix asif,farhana driver's name length not fix driver can have middle name 12728 96a ave address neither length not format is fixed surrey city length not fix bc province fix length v4v 2a1 postal code length fix
636028 I don't know......... may be driving class 87293137 licence no ............... length fix
0808 expiry date length fix
19821106 is the dob of driver length fix
I want to extract information in bold. there are a number of fields having fix length but not all.
thanks
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes
Since the lengths are not all fixed, you will obviously have to handle them as delimited fields. But are you saying they don't have consistent delimiters? It looks as though there are at least two different delimiter characters, "^" and ";". Does that sound right?
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
delimiters are consistent they are not changing at all. I am really uncertain if I can ever do this. I can't find any information on this topic at all. If you can write me a few lines how I can use SPLIT() to extract required information. I think I need to use combination of SPLIT and TRIM functions. Thanks for your interest
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
Hi everyone,
Today I finished the module to extract information by a magnetic card reader. I designed it to read vendors' driving licences and extracted desired information from there, and displayed it in their respective text boxes.
It was fun doing this. I used several combinations of LTRIM(), RTRIM(), SPLIT(), UCASE(), MID().
I used MX3 card reader - it proved very flexible and does not require any special software. If anyone ever needs help in programming for magnetic card reader, I'll be happy to assist.
Kind Regards.
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes
That's great news, creative1. :)
Sorry we seem to have left you hanging on this one. With so much going on, it's easy to lose track of a thread. Don't be scared to drop in an occasional reminder.
| | Newbie | | Join Date: Jan 2008
Posts: 1
| | | re: Read information from magnetic card reader and display in various textboxes
Hi,creative1
No need for all these combinations ( LTRIM(), RTRIM(), SPLIT(), UCASE(), MID().)
You may use only one Split() function to claim all the split strings.
Here is a code that may help. - Dim myreaderinfo As String
-
Dim wd() As String
-
myreaderinfo = 'put your incoming information here.
-
wd() = Split(myreaderinfo, "^")
-
text1.text = wd(0)
-
text2.text = wd(1)
-
text3.text = wd(2)
-
'and so on .......
-
'but remember to count the ^s because the textboxes should be the same number as the splits.
Thanks
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 Hi everyone,
Today I finished the module to extract information by a magnetic card reader. I designed it to read vendors' driving licences and extracted desired information from there, and displayed it in their respective text boxes.
It was fun doing this. I used several combinations of LTRIM(), RTRIM(), SPLIT(), UCASE(), MID().
I used MX3 card reader - it proved very flexible and does not require any special software. If anyone ever needs help in programming for magnetic card reader, I'll be happy to assist.
Kind Regards. Hi! I am struggling with the same issue, I have a mag card reader and Would like to know how I can make it output information into textboxes. Thank you for the help!!!
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
Which magnetic card reader you are using?
Are you able to read information from your card or not?
Do yo have a software for your card reader?
If yes; How it looks like?
Which card you are reading? Is this the only card that will be used?
If knowing all that I can help you.
Kind Regards
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 Which magnetic card reader you are using?
Are you able to read information from your card or not?
Do yo have a software for your card reader?
If yes; How it looks like?
Which card you are reading? Is this the only card that will be used?
If knowing all that I can help you.
Kind Regards Hi! Thank you much for the reply! I am using a card reader (MSR210U series) basic black rectangular reader. If I open note pad and scan a driverslicence, it spits all data not in nice way, something like this:
%414142452555555 E 7772777 ?
;525252678272627=9992828288=?
%TXDallasMoore$James^654 Highland ROAD$^?
- The card reader didn't come with a software, I just plug it to a usb port
- I am gonna eventually want to use credit card with it as well. Thank you!
| | Newbie | | Join Date: Jan 2008
Posts: 1
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by etalon25 Hi! Thank you much for the reply! I am using a card reader (MSR210U series) basic black rectangular reader. If I open note pad and scan a driverslicence, it spits all data not in nice way, something like this:
%414142452555555 E 7772777 ?
;525252678272627=9992828288=?
%TXDallasMoore$James^654 Highland ROAD$^?
- The card reader didn't come with a software, I just plug it to a usb port
- I am gonna eventually want to use credit card with it as well. Thank you! 1st - change all %^?; to space
2nd - and then slipe(string,space)
3rd - read the array a take the value that you want
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by SoftwareEngineer 1st - change all %^?; to space
2nd - and then slipe(string,space)
3rd - read the array a take the value that you want Hi! I don't know how to put data from the card reader into a variable to process it.Basically I don't know how to make communication between the card reader and the form.
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by etalon25 Hi! I don't know how to put data from the card reader into a variable to process it.Basically I don't know how to make communication between the card reader and the form. If it pops into Notepad automatically, chances are it will turn up as though the user typed it.
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by SoftwareEngineer 2nd - and then slipe(string,space) What the heck does "slipe" mean?
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 Which magnetic card reader you are using?
Are you able to read information from your card or not?
Do yo have a software for your card reader?
If yes; How it looks like?
Which card you are reading? Is this the only card that will be used?
If knowing all that I can help you.
Kind Regards Hi! Here is my email: [ Removed] if you could please send me a sample code. Thanks!
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes
Sorry etalon25, site posting guidelines prohibit the posting of personal contact info. This is to protect you against scammers and spammers who may scan the forum.
If you want people to contact you "off-list" they can do so by clicking your ID to go to your profile, and using the options there to send a Private Message, e-mail, instant message or whatever. Depending on what options you have switched on at the time, of course.
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by Killer42 Sorry etalon25, site posting guidelines prohibit the posting of personal contact info. This is to protect you against scammers and spammers who may scan the forum.
If you want people to contact you "off-list" they can do so by clicking your ID to go to your profile, and using the options there to send a Private Message, e-mail, instant message or whatever. Depending on what options you have switched on at the time, of course. Okay! I didn't know that. Sorry about that. Because I don't get notified of new replies I thought I 'd give my email. Thanks!
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by etalon25 Okay! I didn't know that. Sorry about that. Because I don't get notified of new replies I thought I 'd give my email. Thanks! The site should notify you of replies, as far as I know. But it is going through a number of changes, so maybe this feature is down.
I'll ask the Admins.
(Note, it might depend on your "subscription" type for the thread, too.)
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by Killer42 The site should notify you of replies, as far as I know. But it is going through a number of changes, so maybe this feature is down.
I'll ask the Admins.
(Note, it might depend on your "subscription" type for the thread, too.) I am still struggling with the card reader, Can anyone please help!!
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by etalon25 I am still struggling with the card reader, Can anyone please help!! What happens if you simply run your application and give it the focus, say in a textbox, then swipe a card - anything?
As for the notifications, apparently there has been a bug in that for some time. I think you can work around it by changing the notification type, because it defaults to None. I'm assured this will soon be fixed.
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
hi
sorry for late reply I was busy and couldn't send you ;
here is logical flow of the program:
Add a command button call it ScanCard
on the click of the button set control to a textbox say text1.text,
display a message for the user to swipe the card;
at this step card will sent its information to text1.text
now its your turn to play the trick with your string;
once you will finish your trick minimize the size of text1.text and hide it behind you ScanCard command button; so people may not see whats is happening behind the scene.
Regards
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
Your second step for progrmming to extract useful information from your string. First of all decide what you want from this string and then know what is what in this string. %414142452555555 E 7772777 ?
;525252678272627=9992828288=?
%TXDallasMoore$James^654 Highland ROAD$^? 654 Highland ROAD$^? Address TXDallasMoore$James is name
I can't pick other
so its your turn to step ahead.
Kind Regards
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes
If that's "real" personal info we should edit it out.
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
Not sure about etalon25's posts but all data that I show you guys in my entries is fake. I know it could be critical for someone.
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by Killer42 If that's "real" personal info we should edit it out. That fake data, i just came out with numbers and stuff.
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 hi
sorry for late reply I was busy and couldn't send you ;
here is logical flow of the program:
Add a command button call it ScanCard
on the click of the button set control to a textbox say text1.text,
display a message for the user to swipe the card;
at this step card will sent its information to text1.text
now its your turn to play the trick with your string;
once you will finish your trick minimize the size of text1.text and hide it behind you ScanCard command button; so people may not see whats is happening behind the scene.
Regards Hi! Thank you for the reply, ididn't event get notification. So, it's that simple, I don't have to mess with HID classes or any of that, just set focus on the textbox , so people will see text1.text the first time?
| | Newbie | | Join Date: Aug 2007
Posts: 10
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 Your second step for progrmming to extract useful information from your string. First of all decide what you want from this string and then know what is what in this string. %414142452555555 E 7772777 ?
;525252678272627=9992828288=?
%TXDallasMoore$James^654 Highland ROAD$^? 654 Highland ROAD$^? Address TXDallasMoore$James is name
I can't pick other
so its your turn to step ahead.
Kind Regards Hi! How do you hide textbox behind the button, I can't get it to hide.
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by etalon25 Hi! How do you hide textbox behind the button, I can't get it to hide. I think if you simply set their .Top and .Left properties the same, that would do the trick. You may also have to play with which one is in front of the other, I suppose. If necessary, look up Zorder in the doco.
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
hi
what I do is, I minimize the size of textbox to make it smaller than the size of commandbutton and then bring it over the button and set Set Bring to front (for button) (after you finish the programming)
No big trick
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 what I do is, I minimize the size of textbox to make it smaller than the size of commandbutton and then bring it over the button and set Set Bring to front (for button) (after you finish the programming) Note, you could also just use "Send to Back" on the textbox - same effect. :)
Personally, I've always preferred to leave controls like this where I can see them, and pop a bit of code in somewhere like the Form_Load event to move them.
By the way, you can also get a similar effect by simply moving the textbox off the form. For example, move it to negative coordinates. Or just past the right or bottom of the form.
| | Needs Regular Fix | | Join Date: Sep 2007 Location: Canada
Posts: 274
| | | re: Read information from magnetic card reader and display in various textboxes
Killer42
great tip? I am impressed
| | Moderator | | Join Date: Oct 2006 Location: Australia
Posts: 7,748
| | | re: Read information from magnetic card reader and display in various textboxes Quote:
Originally Posted by creative1 Killer42
great tip? I am impressed Thanks. But if you do move things just off the visible form, remember to consider the possibility of changing screen resolution.
|  | Similar Visual Basic 4 / 5 / 6 bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,439 network members.
|