nlobak
Member
- Joined
- Jun 7, 2009
- Messages
- 5
- Programming Experience
- Beginner
In the main form the user can choose to download information from a device.
Since this request takes time, when "download information" is pressed I open new form in a separate thread:
I need the ProgressBarForm to show progress and write the log of the progress.
The problem is: after the user closes the ProgressBarForm the main window is minimized, and I need to activate it to bring it back up.
But the user can see the bringing back from minimized, and it doesn't looks good and gives a feeling that the program is not stable.
Does anyone know why is this happening and how to make the main form not to minimize itself?
Since this request takes time, when "download information" is pressed I open new form in a separate thread:
VB.NET:
Private Sub RunDownload()
Me.Enabled = False
Me.Cursor = Cursors.WaitCursor
Shell(Query, AppWinStyle.Hide, False, -1)
'show progress
ProgressBarProcess.RunWorkerAsync()
End If
End Sub
Private Sub ProgressBarProcess_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles ProgressBarProcess.DoWork
Dim NewProgressBarForm As New ProgressBarForm
NewProgressBarForm.ShowDialog()
NewProgressBarForm.Dispose()
NewProgressBarForm = Nothing
End Sub
Private Sub ProgressBarProcess_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles ProgressBarProcess.RunWorkerCompleted
ProgressBarProcess.CancelAsync()
ProgressBarProcess.Dispose()
Me.Enabled = True
Me.Activate()
Me.Cursor = Cursors.Default
End Sub
I need the ProgressBarForm to show progress and write the log of the progress.
The problem is: after the user closes the ProgressBarForm the main window is minimized, and I need to activate it to bring it back up.
But the user can see the bringing back from minimized, and it doesn't looks good and gives a feeling that the program is not stable.
Does anyone know why is this happening and how to make the main form not to minimize itself?