vb6代码转c#代码

yafun 2010-05-19 12:24:39
求助,帮我把以下vb6代码转为c#代码,谢谢!
Option Explicit
Private Const cConnectString = "ConnectString"
Private Const cUserName = "UserName"
Private Const cUserID = "UserID"
Private Const cDBMSName = "DBMS Name"
Private Const cDBMSVersion = "DBMS Version"
Private m_colParse As Collection
Private m_sParseString As String
Public Property Get PropsString() As String
PropsString = m_sParseString
End Property
Public Property Get UserName() As String
UserName = GetProperty(cUserName)
End Property
Public Property Get UserID() As Integer
UserID = CInt(GetProperty(cUserID))
End Property
5
Public Property Get ConDBMSName() As String
ConDBMSName = GetProperty(cDBMSName)
End Property
Public Property Get ConDBMSVersion() As String
ConDBMSVersion = GetProperty(cDBMSVersion)
End Property
Public Property Get ConStr() As String
ConStr = GetProperty(cConnectString)
End Property
Public Function GetProperty(ByVal sPropName As String) As String
GetProperty = m_colParse(sPropName)
End Function
Public Function ParseString(ByVal sToParse As String) As Boolean
Dim sName As String
Dim sValue As String
m_sParseString = sToParse
Set m_colParse = New Collection
Do
sName = GetName(sToParse)
sValue = GetValue(sToParse)
If sName <> "" Then
m_colParse.Add sValue, sName
Else
Exit Do
End If
Loop
ParseString = True
End Function
Private Function SearchString(sBeSearch As String, ByVal sFind As String) As String
On Error GoTo Err_SearchString
Dim v As Variant
v = Split(sBeSearch, sFind, 2, vbTextCompare)
6
Dim lb As Integer, ub As Integer
lb = LBound(v)
ub = UBound(v)
If ub > lb Then
sBeSearch = v(ub)
SearchString = v(lb)
ElseIf ub = lb Then
sBeSearch = ""
SearchString = v(ub)
Else
sBeSearch = ""
SearchString = ""
End If
Exit Function
Err_SearchString:
sBeSearch = ""
SearchString = ""
End Function
Private Function GetName(sBeSearch As String) As String
GetName = SearchString(sBeSearch, "=")
GetName = Trim$(GetName)
End Function
Private Function GetValue(sBeSearch As String) As String
sBeSearch = Trim$(sBeSearch)
If Left$(sBeSearch, 1) = "{" Then
sBeSearch = Mid$(sBeSearch, 2)
GetValue = SearchString(sBeSearch, "}")
SearchString sBeSearch, ";"
Else
GetValue = SearchString(sBeSearch, ";")
End If
GetValue = Trim$(GetValue)
7
End Function
Public Function IsIndustry() As Boolean
IsIndustry = (UCase(MParse.GetProperty("AcctType")) = "GY")
End Function
...全文
82 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fuxm985 2010-05-19
  • 打赏
  • 举报
回复
同时要懂两门语言才行啊.....
yafun 2010-05-19
  • 打赏
  • 举报
回复
急,没有人能帮我吗?

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧