943,974 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 433
  • VB.NET RSS
Dec 14th, 2008
0

menus freezing at runtime

Expand Post »
Hi

I am working on a pocket pc application. I am displaying text as one word at a time on the screen with a delay of 240ms. But the problem is as soon the the text starts running on the screen ,, i cant access any menu functions. It is possibly something to with the threads but what it is actually i cant figure it out. Any ideas would be much appreciated.
Thanks in advance.


Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click

Try

Dim t1 As New Thread(AddressOf th1)
t1.Start()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Public Sub th1()
Me.BeginInvoke(New InvokeDelegate(AddressOf txt))
End Sub
Public Sub txt()
Dim readcontents As String
readcontents = TextBox1.Text
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(240)

Next

End Sub
Reputation Points: 10
Solved Threads: 0
Newbie Poster
harrybern is offline Offline
6 posts
since Nov 2008
Dec 15th, 2008
0

Re: menus freezing at runtime

I don't do PocketPC programming but I think System.Threading.Thread.Sleep(240) makes your "main" thread to sleep instead of "current" thread. As you can see, I'm not that familiar with threading either
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Dec 15th, 2008
0

Re: menus freezing at runtime

Thanks for your reply.
The format that i am using for sleep method is for the current thread i have checked that. Interestingly the same code works well for desktop pc. I am really a beginner and threading methods for pocket pc are very different (limited) than desktop pc.
But i need to get this going...

Cheers
Reputation Points: 10
Solved Threads: 0
Newbie Poster
harrybern is offline Offline
6 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: file copying itself
Next Thread in VB.NET Forum Timeline: scrollbar control that is changing its colour





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC