关于VB.NET中多线程和委托界面假死无响应的问题
以下代码,当线程在运行时,界面假死无响应ImportsSystem.ThreadingPublicClassForm1DelegateSubqq163()DimcfAsT...
以下代码,当线程在运行时,界面假死无响应
Imports System.Threading
Public Class Form1
Delegate Sub qq163()
Dim cf As Thread
Dim bf As Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cf = New Thread(AddressOf bc)
cf.Start()
End Sub
Sub bc()
Dim cs As New qq163(AddressOf js)
Invoke(cs)
End Sub
Sub js()
For i = 0 To 30
RichTextBox1.Text = RichTextBox1.Text & i & ","
RichTextBox1.Refresh()
Thread.CurrentThread.Sleep(1500)
Next
End SubEnd Class
如何解决界面假死无响应的问题呢?谢谢各位 展开
Imports System.Threading
Public Class Form1
Delegate Sub qq163()
Dim cf As Thread
Dim bf As Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cf = New Thread(AddressOf bc)
cf.Start()
End Sub
Sub bc()
Dim cs As New qq163(AddressOf js)
Invoke(cs)
End Sub
Sub js()
For i = 0 To 30
RichTextBox1.Text = RichTextBox1.Text & i & ","
RichTextBox1.Refresh()
Thread.CurrentThread.Sleep(1500)
Next
End SubEnd Class
如何解决界面假死无响应的问题呢?谢谢各位 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询