在程序执行期间,对话形式仍然可见 [英] Dialogue form remains visible during program execution

查看:48
本文介绍了在程序执行期间,对话形式仍然可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的对话形式(有时是部分,有时作为一个整体)在相当长的处理工作期间仍然可见



对话框要求用户输入一些数据接下来的工作,以及确定之后的
应该消失,处理工作(Sub CreateHTML())启动,

,同时在主窗体中显示进度条。 br />
问题是对话形式保持可见,并且在执行作业期间不会关闭
。工作完成后它会关闭。

我做错了什么?我应该为处理

工作启动一个单独的线程,还是有一个我不知道的更简单的解决方案?代码如下:


Dim fh As new frmHTML

如果fh.ShowDialog(Me)= DialogResult.OK那么

''保存对话数据:

''(我认为不相关,但保留清晰)

DBDirectory = Directory.GetCurrentDirectory

HLang = fh.cmbLanguage.Text

HMainOnly = fh.radMain.Checked

HVarCols = Val(fh.txtCols.Text)

DBDirectory = fh。 txtOutput.Text

fh.Dispose()''摆脱对话形式(我以为......)

''做处理工作:

CreateHTML()

否则

fh.Dispose()

结束如果


感谢您的回复。

/ Ger

My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML()) starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing
job, or is there a more simple solution I am not aware of yet? Code below:

Dim fh As New frmHTML
If fh.ShowDialog(Me) = DialogResult.OK Then
''save dialogue data:
''(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val(fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose() ''Get rid of the dialogue form (I thought......)
'' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger

推荐答案

Ger写道:
Ger wrote:
在相当长的处理工作期间,我的对话形式(有时是部分,有时是整体)仍然可见。
对话要求用户输入一些数据以便跟随作业,以及<无线电通信好后,应该消失并且处理作业(Sub CreateHTML())启动,
同时在主窗体中显示进度条。
问题是对话框保持可见但不关闭
执行工作期间。工作完成后它会关闭。
我做错了什么?我应该为处理工作启动一个单独的线程,还是有一个我不知道的更简单的解决方案?代码如下:

Dim fh As new frmHTML
如果fh.ShowDialog(Me)= DialogResult.OK那么
''保存对话数据:
''(不是相关我认为,但保留清晰)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val( fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose()''摆脱对话形式(我以为......)
''做处理工作:
CreateHTML()
其他
fh.Dispose()
结束如果

感谢您的回复。
/ Ger
My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML()) starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing
job, or is there a more simple solution I am not aware of yet? Code below:

Dim fh As New frmHTML
If fh.ShowDialog(Me) = DialogResult.OK Then
''save dialogue data:
''(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val(fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose() ''Get rid of the dialogue form (I thought......)
'' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger



尝试在处置后立即插入application.doevents。那个

让应用程序有时间清理图形。


Rinze


Try inserting an application.doevents right after the dispose. That
gives the app the time to clean up the graphics.

Rinze


Ger,


在我看来你的程序应该可以工作,你是否用另一个对话框试试了

表格,只有这个呢?


Private Sub Button1_Click(ByVal sender As System.Object,_

ByVal e As System.EventArgs)处理Button1.Click

Me.DialogResult = DialogResult .OK

结束子


试试这个效果?


Cor

Ger < ge ********* @renenospam.sailsoft.nl>
Ger,

In my opinion your program should work, did you try it with another dialog
form with by instance only this on it?

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.DialogResult = DialogResult.OK
End Sub

Just to try the effect?

Cor
"Ger" <ge*********@rathernospam.sailsoft.nl>
我的对话形式(有时是部分,有时是整体)仍然可见
期间一个相当长的处理工作。
对话框要求用户输入一些要跟随的工作数据,并且确定后,应该消失并且处理工作(Sub CreateHTML())
启动,
同时在主窗体中显示进度条。
问题是对话形式在执行作业期间保持可见并且不会关闭。工作完成后它会关闭。
我做错了什么?我应该为处理工作启动一个单独的线程,还是有一个我不知道的更简单的解决方案?代码如下:

Dim fh As new frmHTML
如果fh.ShowDialog(Me)= DialogResult.OK那么
''保存对话数据:
''(不是相关我认为,但保留清晰)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val( fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose()''摆脱对话形式(我以为......)
''做处理工作:
CreateHTML()
其他
fh.Dispose()
结束如果

感谢您的回复。
/ Ger
My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML())
starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the processing
job, or is there a more simple solution I am not aware of yet? Code below:

Dim fh As New frmHTML
If fh.ShowDialog(Me) = DialogResult.OK Then
''save dialogue data:
''(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val(fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose() ''Get rid of the dialogue form (I thought......)
'' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger



Rinze,


处置不关闭表格,它应该给资源回到GC,但是如果需要它我会越来越怀疑。使用设计器创建的表单

实现了Idisposable,因此它应该自行完成。


但是有一个MSDN页面告诉我们只有表单显示

将被处置。但对我来说绝对不清楚那是什么意思

的意思。我越来越怀疑这个页面是否有关于

没有实现IDisposable并直接通过代码制作的表格。


(因此我是真的很好奇,如果你的建议会有所帮助)


只是我的想法,


Cor

" C-Services Holland bv < cs*@REMOVEcsh4u.nl>
Rinze,

The dispose does not close the form, it should give the resources back to
the GC, however I am more and more in doubt if that it is needed. A form
created with the designer implements Idisposable, so it should do it itself.

However there is a MSDN page that tells that only forms showed with show
will be disposed. But it is for me absolute not clear what with that is
meant. I am more and more in doubt if that page is telling about a form that
not implements IDisposable and is made directly by code.

(Therefore I am really curious if your recommendation will help)

Just my thought,

Cor
"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl>
Ger写道:
Ger wrote:
我的对话形式(有时是部分,有时作为一个整体)仍然是<在相当长的处理工作期间可见

对话要求用户输入要跟踪的作业的一些数据,并且确定后,应该消失并处理作业(Sub) CreateHTML())
启动,
同时在主窗体中显示进度条。
问题是对话形式在执行作业期间保持可见并且不关闭
。工作完成后它会关闭。
我做错了什么?我应该为
处理工作启动一个单独的线程,还是有一个我不知道的更简单的解决方案?代码
如下:

Dim fh as new frmHTML
如果fh.ShowDialog(Me)= DialogResult.OK那么
''保存对话数据:
''(我认为不相关,但保留清晰)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val(fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose()''摆脱对话形式(我以为......)
''做处理工作:
CreateHTML()
其他
fh.Dispose()
结束如果

感谢您的回复。
/ Ger
My dialogue form (sometimes partly, sometimes as a whole) remains
visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK, should disappear and the processing job (Sub CreateHTML())
starts,
while showing a progress bar in the main form.
The problem is that the dialogue form stays visible and does not close
during execution of the job. It closes after the job is finished.
What am I doing wrong? Should I start a separate thread for the
processing
job, or is there a more simple solution I am not aware of yet? Code
below:

Dim fh As New frmHTML
If fh.ShowDialog(Me) = DialogResult.OK Then
''save dialogue data:
''(not relevant I think, but left it in for clearity)
DBDirectory = Directory.GetCurrentDirectory
HLang = fh.cmbLanguage.Text
HMainOnly = fh.radMain.Checked
HVarCols = Val(fh.txtCols.Text)
DBDirectory = fh.txtOutput.Text
fh.Dispose() ''Get rid of the dialogue form (I thought......)
'' do the processing job:
CreateHTML()
Else
fh.Dispose()
End if

Thank you for replying.
/Ger


尝试在处置后立即插入application.doevents。这使应用程序有时间清理图形。

Rinze


Try inserting an application.doevents right after the dispose. That gives
the app the time to clean up the graphics.

Rinze



这篇关于在程序执行期间,对话形式仍然可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆