title: Compare text with a file Whether text is listed in the file? [Closed Quest]
body: <p>i have problem with my Project</p>
  <p>my textfeld1 = Emospeak Compare text with a file Whether text is listed in the file.</p>
  <p>Sry for my bad English.</p>
  <p>This is my load file Function:</p>
  <pre><code>Public Function INI_ReadValueFromFile(ByVal strSection As String, ByVal strKey As String, ByVal strDefault As String, ByVal strFile As String) As String
       Dim strTemp As String = Space(1024), lLength As Integer
       lLength = GetPrivateProfileString(strSection, strKey, strDefault, strTemp, strTemp.Length, strFile)
       Return (strTemp.Substring(0, lLength))
   End Function
  </code></pre>
  <p>My Function can load my .ini file with this text format</p>
  <p>&quot;[Hey Elice]</p>
  <p>Input=Helles&quot;</p>
  <p>but he can not red 2 input.</p>
  <p>&quot;[Hey Elice]</p>
  <p>Input=Helles</p>
  <p>Input=ahiles&quot;</p>
  <p>And this is my Code for read my file and textfeld sry again for my bad english.</p>
  <pre><code>        If Emospeak.Text = INI_ReadValueFromFile(&quot;Hey Elice&quot;, &quot;Input&quot;, &quot; &quot;, &quot;.\Hey Elice.ini&quot;) Then
          Emospeak.ResetText()
          EmoPic.BackgroundImage = My.Resources.freudig
          My.Computer.Audio.Play(My.Resources.hey_Jess_rechts, AudioPlayMode.Background)
          index = 45
      End If
  </code></pre>
  <p>this code is okay but he read not all text with my file :(
  she read only one text line...</p>
  <p>Can you help me?</p>
  <p>Edit: I found a solution!</p>
  <pre><code>    Private Sub Emospeak_TextChanged(sender As Object, e As EventArgs) Handles Emospeak.TextChanged
      Dim sr1 As New System.IO.FileStream(&quot;Hey Elice1.ini&quot;, IO.FileMode.Open, IO.FileAccess.Read)
      Dim reader1 As New System.IO.StreamReader(sr1)
  
      Do Until reader1.EndOfStream
  
          Dim line As String = reader1.ReadLine
  
          If Emospeak.Text = line Then
              Emospeak.ResetText()
              EmoPic.BackgroundImage = My.Resources.freudig
              My.Computer.Audio.Play(My.Resources.hey_Jess_rechts, AudioPlayMode.Background)
              index = 45
          End If
  
      Loop
  End Sub
  </code></pre>
  <p>LG Jess</p>
  <p>Closed Quest</p>