简体   繁体   中英

How to Set DatagridView Value

I have a winform that extract datetime information from a biometric device, and display the information on an unbound datagridview in the following format.

S/N        Type    Veri       Name     Datetime
====       ====    ====       ====     ========
1           1       2          emp     2012/12/01 13:00

How can I replace the Type=1 to "In", and Veri=2 to "FP"??  

This is my current code. and also, the way I am merging the year/month/day time is this done correctly?

vRet = Form1.SBXPC1.GetAllGLogData(mMachineNumber, vTMachineNumber, vSEnrollNumber,     vSMachineNumber, vVerifyMode, vYear, vMonth, vDay, vHour, vMinute, vSecond)
            If vRet = False Then Exit Do
            vRet = Form1.SBXPC1.GetUserName1(mMachineNumber, vSEnrollNumber, vName)
            If vRet = True And i <> 1 Then
                DataGridView2.ColumnCount = 7
                DataGridView2.Columns(0).Name = "S/N"
                DataGridView2.Columns(1).Name = "DeviceID"
                DataGridView2.Columns(2).Name = "Enroll"
                DataGridView2.Columns(3).Name = "Name"
                DataGridView2.Columns(4).Name = "DN"
                DataGridView2.Columns(5).Name = "Veri"
                DataGridView2.Columns(6).Name = "Datetime"
            End If
            Dim row As String() = New String() {i, vTMachineNumber, vSEnrollNumber, vName, vSMachineNumber, vVerifyMode, CStr(vYear) & "/" & (vMonth) & "/" & (vDay) & " " & (vHour) & ":" & (vMinute)}
            DataGridView2.Rows.Add(row)

如果出现以下情况,我将使用立即数:

Dim row As String() = New String() {i, vTMachineNumber, vSEnrollNumber, vName, vSMachineNumber, If(vVerifyMode = 2, "FP", ""), CStr(vYear) & "/" & (vMonth) & "/" & (vDay) & " " & (vHour) & ":" & (vMinute)}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM