[connection]
server=localhost
user=root
password=root
我的程序应该返回部分名称和字段: 连接 服务器 用户 密码
提前致谢..
答案 0 :(得分:0)
以防有人需要它。这是:
Dim path As String = Application.StartupPath & "\path_to_file"
' get a list of the files in this directory
' -----------------------------------------
Dim file_list As String() = Directory.GetFiles(path, "*.ini")
' go through the list of files
' -------------------------------------------------------------------
For Each f As String In file_list
Dim a = New System.IO.FileInfo(f).Name
' open the file and read it
' -------------------------
Dim sr As StreamReader = New StreamReader(f)
' read through the file line by line
' -----------------------------------
Do While sr.Peek() >= 0
Dim temp_name = Split(sr.ReadLine(), "=")
first_part = temp_name(0)
second_part = temp_name(1)
' do something with the information here
Loop
sr.Close()
Next