快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

vbnet读取ini,vbnet读取内存地址

VB.NET2010读取INI配置文件问题?

设计功能

10年积累的成都网站建设、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先做网站设计后付款的网站建设流程,更有烈山免费网站建设让你可以放心的选择与我们合作。

说明:第一个参考页导入了System.IO

功能sdGetIniInfo(字符串的BYVAL iniSection的字符串,BYVAL INIFILE),如果该字符串/ File.Exists (INIFILE返回的“文件”INIFILE的的)

,而“未找到,以确保路径和文件名是否正确!”如果

黑暗iniRead

昏暗的iniStr新的StreamReader(INIFILE),的字符串iniRead.ReadToEnd

朦胧朦胧的整数

最后的出口,克莱因整数

昏暗的NOSEC布尔=假

作为一个字符的字符串昏暗的getValue“

黑暗的壁橱

衣柜iniStr.Split(CHR(13 ))CLINE = UBOUND功能的(CLST)

= 0 CLINE

衣柜(I)的indexOf(“=”) 0,

衣柜(I)分裂(“=”) (0)TRIM()= iniSection

NOSEC =

的getValue = CLST(I)分裂(“=”;)(1)修剪()

BR /退出

最后,如果

如果NOSEC = TRUE

返回的getValue BR /

的安装信息没有找到“iniSection!”

功能

====如果=================== ===================

TEXT1 = sdGetIniInfo(路径,“名称”)

事实上,无论是ini文本文件XML只使用一定的格式,或所谓的数据结构,在最后的分析中,实现的文件操作的功能只是一个包文件的读取和写入操作。

是不是写一个函数的API!

求大神指点 vb.net 怎么读 ini 配置呢

VB.NET读写INI配置文件

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim path As String

path = Application.StartupPath + "\Send.ini"

TextBox1.Text = GetINI("Send", "Send1", "", path)

TextBox2.Text = GetINI("Send", "Send2", "", path)

Dim IsSms As Integer = GetINI("Send", "IsSms", "", path)

If (IsSms = 1) Then

Me.RadioButton1.Checked = True

ElseIf (IsSms = 0) Then

Me.RadioButton2.Checked = True

End If

End Sub

Public Function GetINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As String

Dim Str As String = LSet(Str, 256)

GetPrivateProfileString(Section, AppName, lpDefault, Str, Len(Str), FileName)

Return Microsoft.VisualBasic.Left(Str, InStr(Str, Chr(0)) - 1)

End Function

Public Function WriteINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As Long

WriteINI = WritePrivateProfileString(Section, AppName, lpDefault, FileName)

End Function

Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Int32, ByVal lpFileName As String) As Int32

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Int32

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Try

Dim path As String

path = Application.StartupPath + "\Send.ini"

WriteINI("Send", "Send1", TextBox1.Text, path)

WriteINI("Send", "Send2", TextBox2.Text, path)

If (Me.RadioButton1.Checked = True) Then

WriteINI("Send", "IsSms", 1, path)

ElseIf (Me.RadioButton2.Checked = True) Then

WriteINI("Send", "IsSms", 0, path)

End If

MsgBox("配置设置已经成功!!!!")

Catch ex As Exception

MsgBox("错误!!!!")

End Try

End Sub

vb.net 读取ini的所有值

Dim s As String() = System.IO.File.ReadAllLines("t.ini") '文件

For i As Integer = 0 To s.Length - 1

Dim si As Integer = s(i).IndexOf("=")

If si  -1 Then

ListBox1.Items.Add(s(i).Substring(0, si)  " = "  s(i).Substring(si + 1))

End If

Next

's(i).Substring(0, si)是变量名,s(i).Substring(si + 1)是值

vb.net 读取ini问题

Dim Str As String

Str = ""

Str = LSet(Str, 256)

GetPrivateProfileString(bookto, AppName, lpDefault, Str, Len(Str), FileName)

Return Microsoft.VisualBasic.Left(Str, InStr(Str, Chr(0)) - 1)


新闻标题:vbnet读取ini,vbnet读取内存地址
文章链接:http://6mz.cn/article/phegdo.html

其他资讯