How to convert this code from vb6 to c#
Dear All,
I'm new in C#, It's difiifcult for me to change this code in vb6 to c#
Could anybody help me to convert this code to c#
Private Static Sub ShowData(Data As String)
Dim stx, ret, ret1 As Integer
Dim valcom As Variant
Dim strg As String
strg = strg & Data
stx = InStr(strg, Chr$(2))
If stx Then
ret = InStr(stx + 1, strg, Chr$(13))
Else
ret = 0
End If
If ret Then
If ret - stx <> 16 Then
strg = vbNullString
Exit Sub
End If
If Len(strg) < 17 Then Exit Sub
valcom = Val(Mid(strg, stx + 4, 6))
If Not IsNumeric(valcom) Then
strg = vbNullString
Exit Sub
End If
ret = Asc(Mid(strg, stx + 2, 1)) And 2
ret1 = Asc(Mid(strg, stx + 1, 1)) And 7
strg = vbNullString
If ret1 = 2 Then
lbldaucan = Format(IIf(ret - 2, valcom, valcom * (-1)), "#,#")
ElseIf ret1 = 3 Then
lbldaucan = Format(IIf(ret - 2, valcom / 10, (valcom / 10) * (-1)), "0.0")
ElseIf ret1 = 4 Then
lbldaucan = Format(IIf(ret - 2, valcom / 100, (valcom / 100) * (-1)), "0.00")
ElseIf ret1 = 5 Then
lbldaucan = Format(IIf(ret - 2, valcom / 1000, (valcom / 1000) * (-1)), "0.000")
End If
'lblcom1.Caption = valcom
If lbldaucan = "" Then
lbldaucan = 0
End If
End If
End Sub