被要求把vb的这段程序用c#重写,可俺c#都还很菜,vb完全不懂 = =+
我查了一下说是On Error Resume Next 是遇到错误也跳过去继续向下执行,似懂非懂...
源代码如下,这里在c#该怎么处理呢? try catch??
拜谢各位大侠指点。。。。 (┬_┬)
Private Sub CS_GetWinSockERR()
Dim msg As String
Dim WSDesc As New VB6.FixedLengthString(128)
Dim WSErrno As Short
Error_No = CF_winsockerror(WSErrno, WSDesc.Value, Len(WSDesc.Value))
If (WSErrno <> 0) Then 'WSErrno = 0: no winsock error
MsgBox(Trim(WSDesc.Value), , G_STARVSNSQL)
End If
End Sub
Public Function CF_winsockerror(ByRef WSErrorNo As Short, ByRef WSErrorDesc As String, ByRef WSErrorLen As Short) As Short
On Error Resume Next
error_no = ltWinSockError(CInt(WSErrorNo), WSErrorDesc, CInt(WSErrorLen))
CF_winsockerror = CShort(error_no)
End Function
记得写ASP的时候,用过这一句的。
写个try{函数代码}catch{啥也不写}。