I need a little help on an InvalidoperationException was unhandled by user code.
The error occurs when I call this Sub located in a Module from a Timer (System.Timers.Timer) also located in the Module.
Thank you in advance.
This is a Google translation of the error message from VB.NET
An error occurred during the creation of the form. See Exception.InnerException for more information. The error was: User thread should be STA, because this is required for many UI components.
Code:Public Sub SetSpeechActive(ByVal TurnOn As Boolean) If TurnOn Then frmMain.picSpeechActive.Image = System.Drawing.Image.FromFile(System.Windows.Forms.Application.StartupPath & "\images\online16.png") Else frmMain.picSpeechActive.Image = System.Drawing.Image.FromFile(System.Windows.Forms.Application.StartupPath & "\images\offline16.png") End If End Sub