📄 mdini.bas
字号:
Attribute VB_Name = "Mdini"
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2008/05/11
'描 述:天宏钢构仓库管理系统 Ver 2.96
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Function GetProfile(strFileName As String, strSection As String, strName As String) As String
'这个函数是用来对INI文件进行读操作的
'函数说明:
'strFileName 是所要读取的文件名
'strSection 是这个文件中的一个节点名
'strName 是所要查找的字段名
'返回值:
strSectionTemp = ""
strNameTemp = ""
strreturn = ""
On Error GoTo ErrSrchSection
Open strFileName For Input As #1
' 下面这段程序是用来查找节点的
Do While Not EOF(1)
strCharA = Input(1, #1)
If strCharA = "[" Then
Do While Not EOF(1)
strCharB = Input(1, #1)
If strCharB = "]" Then Exit Do
strSectionTemp = strSectionTemp & strCharB
Loop
End If
If strSectionTemp = strSection Then
strCharA = Input(2, #1)
Exit Do
Else
strSectionTemp = ""
End If
Loop
On Error GoTo ErrReadFile
aa:
'下面这段程序是用来查找所要查找的字段的
strNameTemp = ""
Do While Not EOF(1)
strCharA = Input(1, #1)
If strCharA <> "=" Then
strNameTemp = strNameTemp & strCharA '得到名称
Else
Exit Do
End If
Loop
If strNameTemp = strName Then
Line Input #1, strreturn '如果找到与它匹配的字段名,就返回得到的值
Else
Line Input #1, strreturn '如果未找到与它匹配的字段名,就继续找
GoTo aa
End If
Close #1
GetProfile = strreturn
Exit Function
ErrReadFile:
Dim inrRet As Integer
intret = MsgBox("在文件中没有找到所要查找的字段", vbAbortRetryIgnore, "错误信息")
Select Case intret
Case vbAbort
GetProfile = ""
Close #1
Exit Function
Case vbRetry
Resume
Case vbIgnore
Resume Next
End Select
ErrSrchSection:
MsgBox "节点未找到", vbOKOnly
GetProfile = ""
Close #1
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -