In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces VB.NET how to read INI, the article is very detailed, has a certain reference value, interested friends must read it!
Although it is very convenient to read XML configuration information in VB.NET, sometimes the INI file is still used in the development process, but VB.NET reading INI is not as convenient as in VB. I just wrote a function and now post it, maybe you can use it.
Function sdGetIniInfo (ByVal iniFile As String
ByVal iniSection As String) As String
If Not File.Exists (iniFile) Then
Return "File" & iniFile & "not found, please make sure the path and file name are correct!"
Exit Function
End If
Dim iniRead As New StreamReader (iniFile)
Dim iniStr As String = iniRead.ReadToEnd
Dim i As Integer
Dim cLine As Integer
Dim noSec As Boolean = False
Dim getValue As String = ""
Dim cLst
CLst = iniStr.Split (Chr (13))
CLine = UBound (cLst)
For I = 0 To cLine
If cLst (I) .indexof ("=") > 0 Then
If cLst (I) .split ("=") (0) .trim () = iniSection Then
NoSec = True
GetValue = cLst (I) .split ("=") (1) .trim ()
Exit For
End If
End If
Next
If noSec = True Then
Return getValue
Else
Return "did not find the setting information for" & iniSection & "!"
End If
End Function
Note: Imports System.IO should be referenced first in the referenced face page.
Contents of set.ini file:
Private Sub Button1_Click (ByVal sender As System.Object
ByVal e As System.EventArgs) Handles Button1.Click
Dim name As String
Name = sdGetIniInfo (Application.StartupPath & "\ set.ini", "name")
MsgBox (name)
End Sub
The above is all the contents of the article "how to read INI by VB.NET". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.