真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網站制作重慶分公司

vb.net讀取ini,vbnet讀取文件內容

vb.net 讀取ini的所有值

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

專注于為中小企業(yè)提供成都網站設計、成都網站制作服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)尚義免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯(lián)網行業(yè)人才,有力地推動了上千多家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現(xiàn)規(guī)模擴充和轉變。

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】求個用VS2013讀寫INI的代碼

vb.net有自己的設置,不需要ini,在工程【屬性】-【設置】中設置。

——————

ini設置屬性。

'聲明API函數(shù)

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

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

Return WritePrivateProfileString(Section, AppName, lpDefault, FileName)

End Function

‘調用writeini函數(shù)存儲屬性。

‘section為節(jié)點,也就是ini中帶[]符號的節(jié)點文本

’APPname為存儲的名稱,即ini文件中等于符號前面的文本

’ipdefault為存儲的屬性,即等于符號右邊的文本。

‘filename為存儲的ini文件地址,如d:\save.ini

————————

ini返回屬性。

'聲明API函數(shù)

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 Function GetINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As String

Dim Str As String = ""

Str = LSet(Str, IniCount)

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

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

End Function

’調用getini函數(shù)

‘說明同上。

誰給個vb。net用api函數(shù)讀ini文件的例子?

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

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

Dim Str As String = ""

Str = 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

vb.net 如何讀取ini文件定義的ForeColor顏色值

你好,我不知道你是用什么方法保存的,不過.net里的color有一個方法是Color.FromArgb 你可以這么做,dim c as color=richtextbox1.ForeColor dim colorstring as string=c.ToArgb().ToString colorstring就是顏色的值(字符串)再把colorstring保存到ini文件加載顏色的時候,從ini里讀取colorstring 具體是:dim RtextColor as color=Color.FromArgb(cint(colorstring))richtextbox1.ForeColor =RtextColor

求大神指點 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文件問題

以下是我的辦法:OK!

Public 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 Integer, ByVal lpFileName As String) As Integer

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

寫:

WritePrivateProfileString("存儲", "賬號", textbox1, Application.StartupPath "\song.ini")

讀:

dim s as string

s = string(255," ")

GetPrivateProfileString("存儲", "賬號", s, s.Length, Application.StartupPath + "\song.ini")

textbox1 =s


當前題目:vb.net讀取ini,vbnet讀取文件內容
URL鏈接:http://weahome.cn/article/hshsoc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部