读书人

急C#源VB源,该如何处理

发布时间: 2012-06-08 12:55:24 作者: rapoo

急:C#源VB源
下面段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


[解决办法]

VB code
Private Function FormatErrorCode(ByRef bytes() As Byte) As StringSelect 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 SelectEnd Function 

读书人网 >VB

热点推荐