用vb修改ini文件的代码怎么写啊
用vb修改ini文件的代码怎么写啊在vb上text1和text2输入内容修改ini文件的内容
如:ini文件格式是这样的 Link=http://xxx.com:81 我在text1输入www.csdn.com 在text2输入80 点击按纽
修改结果是这样子的 Link=www.csdn.com:80 应该怎么写啊
--------------------编程问答--------------------
--------------------编程问答-------------------- Dim Str As String
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Function SetIniValue(FileName As String, ByVal clsName As String, ByVal key As String, Optional ByVal Value As String = "")
SetIniValue = WritePrivateProfileString(clsName, key, Value, FileName)
End Function
使用:
dim FileName as string
dim str as string
FileName = "link.ini"
str=text1.text & ":" & text2.text
SetIniValue FileName, "Inof", "Link", str
Open "123.ini" For Append As #1
Str = "Link=" & text1.Text & ":" & text2.Text
Print #1, Str
Close #1
这样会追加到最一行 --------------------编程问答-------------------- 看我博客模块代码.
http://hi.baidu.com/%D2%E4%C4%EA%BB%AA/blog/item/378eb6bf3c09840918d81f06.html
补充:VB , 基础类