harrybern 0 Newbie Poster

Hi All

I am getting this error message when i run my pocket pc application using active sync on my PDA. i get this message when I am using threading in my application otherwise the code works but application crashes when i am trying to access the menus while the main loop is running. Any ideas would be much appreciated.

Many Thanks

ERROR

System.NotSupportedException was unhandled
Message="An error message cannot be displayed because an optional resource assembly containing it cannot be found"
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Windows.Forms.Control.get_Text()
at DeviceApplication1.Form1.rsvp()

My code is as following
Imports System.IO
Imports System
Imports System.Threading
Imports System.Windows.Forms


Public Class Form1
Public Sub rsvp()
Dim readcontents As String = TextBox1.Text

Dim textdelimiter As String

textdelimiter = (" ")
Dim splitout() As String = Split(readcontents, textdelimiter)
Dim i As Integer
For i = 0 To UBound(splitout)


Label1.Text = splitout(i)

Label1.Refresh()


System.Threading.Thread.Sleep(200)
Next
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Dim dlg As OpenFileDialog = New OpenFileDialog()
dlg.Filter = "txt files (*.txt)|*.txt"
'dlg.ShowDialog()
'
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then

Dim filestream As StreamReader = New StreamReader(dlg.FileName)


Dim readcontents As String
readcontents = filestream.ReadToEnd()
TextBox1.Text = readcontents

filestream.Close()


End If
End Sub


Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
Dim value As Boolean = False
'Control.CheckForIllegalCrossThreadCalls = value

Dim t As Thread

t = New Thread(AddressOf rsvp)
t.Start()

End Sub
End Class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.