0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VBでiniファイルの取得方法

Posted at
sample.vb
Const DEF_STR As String = vbNullString
Dim nmBuffer As String = New String(" ", 64)         ' iniファイルから取得した項目(事前に領域を設定)

' iniファイル名を指定
Dim iniFileName As String = Application.StartupPath & "\sourceCheck.ini" 'INIファイル名
        
' 項目名を指定し、設定内容を取得
Dim ret As Integer = GetPrivateProfileString("CHKCONF", "userNm", DEF_STR, nmBuffer, nmBuffer.Length, iniFileName)
        
' 設定内容の一番後ろがnullCharなので、余計なものをtrimしておく
userNmText.Text = nmBuffer.Substring(0, nmBuffer.IndexOf(vbNullChar))
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?