其中一个按钮事件:
Private Sub Command27_Click()
Dim st As Long
Dim AUTH_CODE(8) As Byte
Dim Start_Time(5) As Byte
Dim End_Time(5) As Byte
Dim RD_Add As Integer
Dim Room1(6) As Byte
Dim Room2(6) As Byte
Dim Room3(6) As Byte
Dim CARD_CODE(8) As Byte
Dim CardID As Double
Dim Temp1 As Double
Dim Temp2 As Double
RD_Add = Val(Text9.Text) And &HFF
st = CardCode(CARD_CODE(0))
Temp1 = CARD_CODE(0)
Temp2 = &H1000000
CardID = Temp1 * Temp2
Temp1 = CARD_CODE(1)
Temp2 = &H10000
CardID = CardID + Temp1 * Temp2
Temp1 = CARD_CODE(2)
Temp2 = &H100
CardID = CardID + Temp1 * Temp2
CardID = CardID + CARD_CODE(3)
If Len(Text16.Text) < 16 Then Exit Sub
AUTH_CODE(0) = Val("&H" & Mid(Text16.Text, 1, 2))
AUTH_CODE(1) = Val("&H" & Mid(Text16.Text, 3, 2))
AUTH_CODE(2) = Val("&H" & Mid(Text16.Text, 5, 2))
AUTH_CODE(3) = Val("&H" & Mid(Text16.Text, 7, 2))
AUTH_CODE(4) = Val("&H" & Mid(Text16.Text, 9, 2))
AUTH_CODE(5) = Val("&H" & Mid(Text16.Text, 11, 2))
AUTH_CODE(6) = Val("&H" & Mid(Text16.Text, 13, 2))
AUTH_CODE(7) = Val("&H" & Mid(Text16.Text, 15, 2))
Start_Time(0) = Right(Year(Now), 2)
Start_Time(1) = Month(Now)
Start_Time(2) = Day(Now)
Start_Time(3) = Hour(Now)
Start_Time(4) = Minute(Now)
End_Time(0) = Right(Year(Format(Text26.Text, "yyyy-mm-dd hh:mm:ss"
), 2)
End_Time(1) = Month(Format(Text26.Text, "yyyy-mm-dd hh:mm:ss"
)
End_Time(2) = Day(Format(Text26.Text, "yyyy-mm-dd hh:mm:ss"
)
End_Time(3) = Hour(Format(Text26.Text, "yyyy-mm-dd hh:mm:ss"
)
End_Time(4) = Minute(Format(Text26.Text, "yyyy-mm-dd hh:mm:ss"
)
If Text18.Text = "" Then
MsgBox "请输入楼栋编号(0---15)!"
Exit Sub
End If
Room1(0) = Val(Text18.Text) And &HF
If Text19.Text = "" Then
MsgBox "请输入朝向编号(0---15)!"
Exit Sub
End If
Room1(1) = Val(Text19.Text) And &HF
If Text20.Text = "" Then
MsgBox "请输入楼层编号(0---255)!"
Exit Sub
End If
Room1(2) = Val(Text20.Text) And &HFF
If Text21.Text = "" Then
MsgBox "请输入房号(0---255)!"
Exit Sub
End If
Room1(3) = Val(Text21.Text) And &HFF
If Text22.Text = "" Then
MsgBox "请输入套间编号(0---15)!"
Exit Sub
End If
Room1(4) = Val(Text22.Text) And &HF
If Text23.Text = "" Then
MsgBox "请输入公共区编号(0---15)!"
Exit Sub
End If
Room1(5) = Val(Text23.Text) And &HF
Room2(0) = Room1(0)
Room2(1) = Room1(1)
Room2(2) = Room1(2)
Room2(3) = Room1(3)
Room2(4) = Room1(4)
Room2(5) = Room1(5)
Room3(0) = Room1(0)
Room3(1) = Room1(1)
Room3(2) = Room1(2)
Room3(3) = Room1(3)
Room3(4) = Room1(4)
Room3(5) = Room1(5)
Select Case Combo2.Text
Case "T5557"
st = Guest_Card_57(commdev, RD_Add, AUTH_CODE(0), CARD_CODE(0), Room1(0), Room2(0), Room3(0), Start_Time(0), End_Time(0))
Select Case st
Case 0
List1.AddItem "宾客卡写成功!"
Case 1
List1.AddItem "宾客卡写失败!"
Case 2
List1.AddItem "宾客卡写失败!"
Case 3
List1.AddItem "宾客卡写失败!"
Case 4
List1.AddItem "宾客卡写失败!"
Case 5
List1.AddItem "卡片没有格式化!"
End Select
Case "IC4442"
st = Guest_Card_IC(commdev, AUTH_CODE(0), CARD_CODE(0), Room1(0), Room2(0), Room3(0), Start_Time(0), End_Time(0))
Select Case st
Case 0
st = dv_beep(commdev, 10)
List1.AddItem "宾客卡写成功!"
Case 1
List1.AddItem "宾客卡写失败!"
Case 2
List1.AddItem "宾客卡写失败!"
Case 3
List1.AddItem "宾客卡写失败!"
Case 4
List1.AddItem "宾客卡写失败!"
Case 5
List1.AddItem "卡片没有格式化!"
End Select
End Select
End Sub
有点长,不过估计看得懂的也没什么,都是些重复的,呵呵,谢谢啦。