title: Read .ini file vb.net?
body: <p>I have one project with function to read .ini files. I can not display the contents of .ini file that I want to.</p>
  
  <p>My code to read .ini file</p>
  
  <pre><code>Public Function GetSettingItem(ByVal File As String, ByVal Identifier As String) As String
      Dim S As New IO.StreamReader(File) : Dim Result As String = ""
      Do While (S.Peek &lt;&gt; -1)
          Dim Line As String = S.ReadLine
          If Line.ToLower.StartsWith(Identifier.ToLower &amp; "=") Then
              Result = Line.Substring(Identifier.Length + 2)
          End If
      Loop
      Return Result
  End Function
  </code></pre>
  
  <p>My code to load code </p>
  
  <pre><code>Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Label1.Text = GetSettingItem("D:\WorldInfo.ini", "Count")
      Label2.Text = GetSettingItem("D:\WorldInfo.ini", "Count")
   End Sub
  </code></pre>
  
  <p>my .ini files</p>
  
  <pre><code>[B_Empty_IndexList]
  Count=2
  00_Th=0
  01_Th=1
  [B_Use_IndexList]
  Count=0
  00_Th=-1
  01_Th=-1
  </code></pre>
  
  <p>in my project i wanna load information Count from [B_Empty_IndexList] to Label1 and Count from [B_Use_IndexList] to Label2 .. but when i use my code Label1 and Label2 just load Count from [B_Use_IndexList]</p>
  
  <p>Anyone help me how to read ini file to load information </p>
  
  <pre><code>Label1 -&gt; Load Information Count from [B_Empty_IndexList]
  Label2 -&gt; Load Information Count from [B_Use_IndecList]
  </code></pre>
  
  <p>Sorry for my bad english</p>