窗体运行时无法操作怎么办?

geniusnf 2005-04-10 02:25:02
如题,按了开始,要等完成或出错才可以点击,郁闷——
有谁知道怎么解决,提供个解决途径或示例
——10分感谢
...全文
133 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
geniusnf 2005-04-10
  • 打赏
  • 举报
回复
程序如下:(求指教)要加process?程序运行本身不就是个线程吗?
我在form1外套加了可程序出错啊,怎么加,看了msdn有点不够

Dim button1 As String
Dim button2 As String
Dim cmts接受电平 As String
Dim cmts接受信噪比 As String
Dim cm上行电平 As String
Dim cm下行电平 As Double
Dim cm下行信噪比 As String
Dim cm状态 As String
Dim crcerror指标 As Integer
Dim hit指标 As Integer
Dim insertion指标 As Integer
Dim miss指标 As Integer
Dim p_adj指标 As Integer
Dim time指标 As String
Dim 综合flap指标 As Integer
Dim postData As String
Dim myHttpWebRequest As HttpWebRequest
Dim requestStream As Stream
Dim postBytes As Byte()
Dim myHttpWebResponse As HttpWebResponse
Dim receiveStream As Stream
Dim sr1 As StreamReader
Dim path1 As String = "c:\temp\1.txt"
Dim linex As String
Dim sw As StreamWriter
Dim i1 As Int32
Dim nowtime As DateTime
Dim sd As StreamReader
Dim ss As String
Dim re1 As Regex
Dim m As Match
Dim mc As MatchCollection
Dim sd2 As StreamReader
Dim j As Int16
Dim k As Int64
Dim linecontent As String
Dim m2 As Match
Dim re3 As Regex
Dim m3 As Match





Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 开始.Click

Try


Do While 1 = 1
,这里加System.Windows.Forms.Application.DoEvents()?——没用啊

,主要循环体
,包括post,getrequeststream
, 提取返回信息
,保存信息到access2000数据库

If button2 = 1 Then
Exit Do
button2 = 0
End If
Loop
Catch ex As Exception
MsgBox(ex.ToString)
Console.WriteLine(ex.ToString)
End Try
End Sub

Private Sub 停止_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 停止.Click
button2 = 1
End Sub

xxuu503 2005-04-10
  • 打赏
  • 举报
回复
application.DoEvents

就是这个!
chenhui530 2005-04-10
  • 打赏
  • 举报
回复
加入Application.DoEvents()这个应该是可以响应事件的~除非楼主加入的地方不会或者是楼主在调用一个需要执行很长时间的外部命令而且使用了等待并且没有使用到线程才会出现这样的情况~.希望楼主把代码帖上来问题就好解决了
geniusnf 2005-04-10
  • 打赏
  • 举报
回复
to chenyuming2004(这辈子我算是废了)
我就是不知该怎么做才问的啊

能不能具体点
chenyuming2004 2005-04-10
  • 打赏
  • 举报
回复
application.DoEvents

或者另开一个线程吧。
geniusnf 2005-04-10
  • 打赏
  • 举报
回复
循环体内加了System.Windows.Forms.Application.DoEvents()
没用啊
sjl01 2005-04-10
  • 打赏
  • 举报
回复
不停循环?
饿~~~~~~
试试在循环体加入
system.windows.forms.application.DoEvents
geniusnf 2005-04-10
  • 打赏
  • 举报
回复
就是按一个button开始运行一个不停地循环的程序,窗体就不能点了,设了停止键也点不了
是不是要在循环中加延时,是的话怎么加,
sjl01 2005-04-10
  • 打赏
  • 举报
回复
问题好象没有叙述清楚哦!

16,553

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧