急: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