Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Visual Basic 2010: RFID Reader To Display One Line From Code

  • 01-02-2012 04:22PM
    #1
    Registered Users, Registered Users 2 Posts: 33


    Hi All,

    I am working on a code that can read and displays the rfid tag onto a textbox in Visual Basic 2010. What I am stuck on at the moment is that it displays all of the code from when a card is swiped over the rfid reader and I only want it to display one line which is the UID code line eg.Card UID: 0x88 04 BD 3F 49 BB 02 80. The rfid code that displays is as below:


    IC Type: Philips Mifare UltraLight
    Card UID: 0x88 04 BD 3F 49 BB 02 80
    ATQA Byte[1]: 0x00 ATQA Byte[0]: 0x44 SAK: 0x00

    Serial Number [Page 0]: 0x04 BD 3F 0E .??.
    Serial Number [Page 1]: 0x49 BB 02 80 I?.?
    Internal/Lock [Page 2]: 0x70 48 00 00 pH..
    OTP [Page 3]: 0x00 00 00 00 ....
    Data [Page 4]: 0xFF FF FF FF ????

    Data [Page 5]: 0x00 00 00 00 ....
    Data [Page 6]: 0x00 00 00 00 ....
    Data [Page 7]: 0x00 00 00 00 ....
    Data [Page 8]: 0x00 00 00 00 ....
    Data [Page 9]: 0x00 00 00 00 ....
    Data [Page 10]: 0x00 00 00 00 ....
    Data [Page 11]: 0x00 00 00 00 ....
    Data [Page 12]: 0x00 00 00 00 ....
    Data [Page 13]: 0x00 00 00 00 ....
    Data [Page 14]: 0x00 00 00 00 ....
    Data [Page 15]: 0x00 00 00 00 ....



    As you can see I only want visual basic to display the UID line only. Anyone have an idea on how I can do that please? The part of the code I have for when displaying the rfid code is:

    Private Sub SetText(ByVal [text] As String)
    If Me.TextBox4.InvokeRequired Then
    Dim d As New SetTextCallback(AddressOf SetText)
    Me.Invoke(d, New Object() {[text]})
    Else
    Me.TextBox4.Text = Me.TextBox4.Text & [text] & vbCrLf
    End If



    Any help would be appreciated. Thanks.

    Ciara


Comments

  • Registered Users, Registered Users 2 Posts: 688 ✭✭✭JazzyJ


    Use regular expressions - they're essential to know: http://www.regular-expressions.info/dotnet.html (that's a really good site for reference too)

    Or if its always going to be on the second line, off the top of my head something like (in C#): text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)[1] might work.

    J.


Advertisement