0

Okay let me start that here is the code that in using:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim SAPI
    SAPI = CreateObject("SAPI.spvoice")
    SAPI.Speak(RichTextBox1.Text)
    My.Settings.History.Add(RichTextBox1.Text.ToString)
End Sub

Then I sarted the application. But then I click Button1 I get this:

enter image description here

Without the code for the history it works just fine. Maybe there is a way better way to do it. Please help.

Tim Williams
  • 154,628
  • 8
  • 97
  • 125
Nick
  • 1

1 Answers1

0

That's because your saving your settings wrong. See example below...

Change and save Settings

 My.Settings.History = RichTextBox1.Text
 My.Settings.Save()
Trevor
  • 7,777
  • 6
  • 31
  • 50
  • I tried adding My.Settings.Save() but that didn't work, then I tried changing My.Settings.History.Add(RichTextBox1.Text.ToString) to My.Settings.History = RichTextBox1.Text then I get "Value of type 'String' cannot be converted to 'System.Collections.Specialized.StringCollection'." in the Error List. – Nick Apr 29 '14 at 01:33
  • In your settings, change that field to a string. – Trevor Apr 29 '14 at 01:35
  • NullReferenceException "Object reference not set to an instance of an object." – Nick Apr 29 '14 at 23:50