【发布时间】:2012-02-09 21:57:33
【问题描述】:
我很难将此 sn-p 转换为 VB.NET
Function DecryptPassword(ByVal s As String) As String
Dim i As Integer
Dim sPass As String = s.Trim()
For i = 1 To Len(sPass)
If Asc(Mid$(sPass, i, 1)) - 5 < 124 Then
'this line throws "type char $ does not match declared data type char"
Mid$(sPass, i, 1) = Chr$(Asc(Mid$(sPass, i, 1)) - 5)
Else
Mid$(sPass, i, 1) = Mid$(sPass, i, 1)
End If
Next
DecryptPassword = UCase(sPass) ' Convert UserPassword to UpperCase
End Function
它在 VB6 中运行良好,但在我使用 VB.Net 时抛出错误。
【问题讨论】:
-
您尝试过 Visual Studio 的升级向导吗?
-
你试过没有非$版本的mid吗?
-
@hydroparadise - 升级向导在 VS2010 以后不可用,因此取决于 OP 的版本
-
很高兴知道。我确实有 VB.NET 2010 Express,并注意到它没有。只是以为它不包含在 Express 版本中。
-
据我所知,vb2008 是最后一个包含升级向导的。我想这个的快递版还是可以下载的。不过,我认为您必须花点时间才能注册它。