Sevyt 0 Newbie Poster

I am trying to get a example that came with the card to work to my needs.

The card holds personal data, which you can read with a specific card reader.
Currently the example will either read to a console window or to a single textbox on a form.

My problem is the fact that its to 1 single textbox.
I want each label on the card to be put into its own textbox.
For example
Card Validity end
Card Validity begin
Chip number

There is a lot more data on the card.

I want to have it so i got a textbox

And each label from the card will put into its matching textbox.

My current code is this.

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        FormProg = Me
        Dim dt As New tests.DataTests()
      End Sub

    Public Sub AppendText(ByVal txt As String)
        txtResult.AppendText(txt & Environment.NewLine)
    End Sub

Part of my class

       Public Function GetData(ByVal label As String) As String
            Dim value As [String] = ""
            If m Is Nothing Then
                m = Net.Sf.Pkcs11.Module.GetInstance(mFileName)
            End If
            ' pkcs11 module init
                ' Get the first slot (cardreader) with a token
                Dim slotlist As Slot() = m.GetSlotList(True)
                If slotlist.Length > 0 Then
                    Dim slot As Slot = slotlist(0)

                    Dim session As Session = slot.Token.OpenSession(True)

                    ' Search for objects
                    ' First, define a search template 

                    ' "The label attribute of the objects should equal ..."
                    Dim classAttribute As New ByteArrayAttribute(CKA.CLASS)
                    classAttribute.Value = BitConverter.GetBytes(CUInt(Net.Sf.Pkcs11.Wrapper.CKO.DATA))

                    Dim labelAttribute As New ByteArrayAttribute(CKA.LABEL)
                    labelAttribute.Value = System.Text.Encoding.UTF8.GetBytes(label)

                    session.FindObjectsInit(New P11Attribute() {classAttribute, labelAttribute})
                    Dim foundObjects As P11Object() = session.FindObjects(50)
                    Dim counter As Integer = foundObjects.Length
                    Dim data As Data
                    While counter > 0
                        'public static BooleanAttribute ReadAttribute(Session session, uint hObj, BooleanAttribute attr)
                        data = TryCast(foundObjects(counter - 1), Data)
                        label = data.Label.ToString()
                        If label IsNot Nothing Then
                        End If
                        If data.Value.Value IsNot Nothing Then
                            value = System.Text.Encoding.UTF8.GetString(data.Value.Value)
                        End If
                        counter -= 1
                    End While
                    'Console.WriteLine("No card found" & vbLf)
                    'FormCommon.AppendText("No card found" & vbLf)
                    FormProg.AppendText("No card found" & vbLf)
                End If
                ' pkcs11 finalize
            End Try
            Return value
        End Function

There is more to the program, but most of it is just for the encryption.
I am guessing the Appentext is what deals with all the data going to 1 single textbox.
Don't really know Appendtext, never really used.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.