Read data from external biometric fingerprint device in zkemkeeper

I have this code working properly. i can able to connect & call the number of log from the device but cant able to read Enroll number. when ever the code reaches mesagbox(“2”) & after display it cant able to see mesagebox(“2.5”). it keeps error message “Conversion from string”” to type ‘Integer’ is not valid.”.
when i put this code
“If String.IsNullOrEmpty(dwEnrollNumber) Then
MessageBox.Show(“Error: Empty or invalid User ID”)
Else”
it shows me where it have issue but i cant able to escape this “” value.
Below is the code in general.
I think i make this question clear.

**Imports zkemkeeper
Public Class Form1

    Dim axCZKEM1 As New zkemkeeper.CZKEM
    Dim dt As New DataTable()

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ' Add columns to the DataTable for displaying in DataGridView
        ' Set up DataTable columns for the DataGridView
        dt.Columns.Add("User ID")
        dt.Columns.Add("Check-in Time")
        dt.Columns.Add("Check-out Time")
        dt.Columns.Add("Verification Method")
        dt.Columns.Add("Device ID")
        DataGridView1.DataSource = dt

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MsgBox("OK")
        Dim ip As String = TextBox1.Text ' Replace with your device's IP
        Dim port As Integer = 4370 ' Default ZKTeco port

        If axCZKEM1.Connect_Net(ip, port) Then
            MessageBox.Show("Connection successful!")
        Else
            MessageBox.Show("Failed to connect.")
        End If

        Dim isConnected As Boolean = axCZKEM1.Connect_Net(ip, port)
        If Not isConnected Then
            MessageBox.Show("Failed to reconnect to the device.")
            Return
        End If

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Dim ip As String = TextBox1.Text
        Dim port As Integer = 4370
        Dim dwMachineNumber As Integer = 101 ' Your machine number

        ' Connect to the device
        If axCZKEM1.Connect_Net(ip, port) Then
            MessageBox.Show("Connection successful!")

            ' Clear any old data
            dt.Rows.Clear()

            ' Get the log count from the device
            Dim logCount As Integer = 0
            If axCZKEM1.GetDeviceStatus(dwMachineNumber, 6, logCount) Then
                MessageBox.Show("Log Count: " & logCount.ToString())

                ' Ensure there's at least one log to read
                If logCount > 0 Then
                    MsgBox("0")

                    ' Enable the device to read logs
                    If axCZKEM1.ReadAllGLogData(dwMachineNumber) Then
                        MsgBox("1")

                        ' Loop to read logs
                        Dim dwEnrollNumber As String = ""
                        Dim dwVerifyMode As Integer = 0
                        Dim dwInOutMode As Integer = 0
                        Dim dwYear As Integer = 0
                        Dim dwMonth As Integer = 0
                        Dim dwDay As Integer = 0
                        Dim dwHour As Integer = 0
                        Dim dwMinute As Integer = 0
                        Dim dwSecond As Integer = 0
                        Dim dwWorkCode As Integer = 0

                        MsgBox("2")

                        ' Attempt to read the first log entry
                        Dim isSuccess As Boolean = axCZKEM1.GetGeneralLogData(dwMachineNumber, dwEnrollNumber, dwVerifyMode, dwInOutMode, dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond, dwWorkCode)
                        MsgBox("2.5")
                        ' Check if the initial read was successful
                        If Not isSuccess Then
                            MessageBox.Show("Failed to retrieve the first log data. Ensure valid logs are available.")
                            Exit Sub
                        End If

                        ' Loop to read all log entries
                        While isSuccess
                            MsgBox("3")
                            ' Check if EnrollNumber is valid
                            If Not String.IsNullOrWhiteSpace(dwEnrollNumber) AndAlso IsNumeric(dwEnrollNumber) Then
                                MsgBox("4")
                                Try
                                    MsgBox("5")
                                    ' Create a new row for the DataTable
                                    Dim row As DataRow = dt.NewRow()

                                    ' Fill the row with log details
                                    row("User ID") = dwEnrollNumber
                                    row("Verification Method") = dwVerifyMode.ToString()
                                    row("Device ID") = dwMachineNumber.ToString()

                                    ' Format the log time
                                    Dim logTime As String = New DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString("yyyy-MM-dd HH:mm:ss")
                                    If dwInOutMode = 0 Then
                                        row("Check-in Time") = logTime
                                    ElseIf dwInOutMode = 1 Then
                                        row("Check-out Time") = logTime
                                    End If

                                    ' Add the row to the DataTable
                                    dt.Rows.Add(row)
                                Catch ex As Exception
                                    MessageBox.Show("Error processing log data: " & ex.Message)
                                End Try
                            Else
                                ' Log or skip invalid or empty EnrollNumber
                                MsgBox("Skipped log entry with invalid EnrollNumber: " & dwEnrollNumber)
                            End If

                            ' Attempt to read the next log entry
                            isSuccess = axCZKEM1.GetGeneralLogData(dwMachineNumber, dwEnrollNumber, dwVerifyMode, dwInOutMode, dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond, dwWorkCode)

                            ' If the next read was unsuccessful, show a message
                            If Not isSuccess Then
                                MessageBox.Show("Failed to retrieve subsequent log data. Check if there are more logs to read.")
                                Exit While
                            End If
                        End While

                        ' Bind the data to DataGridView
                        DataGridView1.DataSource = dt
                    Else
                        MessageBox.Show("Failed to read logs from the device.")
                    End If
                Else
                    MessageBox.Show("No logs available to read.")
                End If
            Else
                MessageBox.Show("Failed to retrieve log count.")
            End If
        Else
            MessageBox.Show("Failed to connect to the device.")
        End If

    End Sub
End Class**

New contributor

Alex is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật