读书人

急C#流VB源

发布时间: 2013-01-07 10:02:25 作者: rapoo

急:C#源VB源
本帖最后由 hilary_1989 于 2012-04-27 16:28:19 编辑 下面段C#的 winfrom源怎成VB言代,求助!!!
private void readcard()
{
byte[] byteuid = new byte[256];
byte[] byteBuffer = new byte[256];
string strErrorCode = "";
string strFlag = "";
int nFlag = 0;//卡类型不一样,0x42返回值带安全状态字节,0x02返回值不带安全状态字节
strFlag = "02";
int nRet =MiReader.ISO15693_Read(Convert.ToByte(strFlag), Convert.ToByte(textReadArea.Text), Convert.ToByte(textReadNum.Text), byteuid, byteBuffer);
}

MiReader方法:
[DllImport("mi.dll")]
public static extern int ISO15693_Read(byte flag, byte blk_add, byte num_blk, [In]byte[] uid, [In]byte[] buffer);

重要的是色部份的。。。多!!!
[解决办法]
Public Declare Function ISO15693_Read Lib "mi.dll" (ByVal flag As Byte, ByVal blk_add As Byte, ByVal num_blk As Byte, ByRef uid As Byte, ByRef buffer As Byte) As Long


[解决办法]


Private Function FormatErrorCode(ByRef bytes() As Byte) As String
Select Case bytes(0)
Case &H80
FormatErrorCode = "Success"
Case &H81
FormatErrorCode = "Parameter Error"
Case &H82
FormatErrorCode = "Communication TimeOut"
Case &H83
FormatErrorCode = "Can't Find Card"
Case Else
FormatErrorCode = "Command Error"
End Select
End Function

读书人网 >VB

热点推荐