|
-
May 9th, 2005, 09:13 PM
#1
Thread Starter
Addicted Member
Progress bar for saving process
Can anybody help me for the following?
I want to show a small window with a message "Saving in progress" and a progress bar running, when I save the data to the database. I tried, but the small window get activated once the saving progress finished
Here is my code:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oMessage = New frmDialogBox
oMessage.show()
oMessage.Toplevel = True
Saving()
oMessage.close
End Sub
frmDialogBox form:
VB Code:
Private Sub DialogBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Label1.Text = "Loading In Progress..."
End Sub
Private Sub DialogBox_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
Timer1.Enabled = True
Label1.Text = "Loading In Progress..."
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
If Not ProgressBar1.Value = ProgressBar1.Maximum Then
ProgressBar1.Value += 1
Else
ProgressBar1.Value = 0
End If
End Sub
Thanks
Last edited by haihems; May 9th, 2005 at 09:17 PM.
Think Before Ink
Visual Studio .NET 2002/.NET Framework 1.0
-
May 10th, 2005, 01:04 AM
#2
Junior Member
Re: Progress bar for saving process
Tru update your bar inside Saving(), while work is in process, using a different Thread, and everytime refresh your Label..
-
May 10th, 2005, 01:47 AM
#3
Thread Starter
Addicted Member
Re: Progress bar for saving process
Sorry Andyc,
Can't catch up u?
Am I doing in a right way?
some other code are also appreciable.
Think Before Ink
Visual Studio .NET 2002/.NET Framework 1.0
-
May 10th, 2005, 06:09 AM
#4
Junior Member
Re: Progress bar for saving process
Hi, i think you've only to add a thread to refresh the dialog box objects..
Button Click event:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim T as new Thread(AddressOf ThreadProc) 'Creates the new thread
Dim oMessage = New frmDialogBox
oMessage.showdialog(Me)
oMessage.Toplevel = True
Timer1.Enabled = True
Saving()
T.Abort()
oMessage.close
End Sub
Thread Procedure:
Public Sub ThreadProc()
If ProgBar.Value < 100 Then
ProgBar.Refresh()
ProgBar.Invalidate()
Label1.invalidate
Else
Timer1.Enabled = False
ProgBar.value = 0
End If
End Sub
-
May 10th, 2005, 10:37 PM
#5
Thread Starter
Addicted Member
Re: Progress bar for saving process
Sorry , my saving process is in different form (Form1) and frmDialogbox is a different form. I want to call frmDialog from Form1. How can I?
Think Before Ink
Visual Studio .NET 2002/.NET Framework 1.0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|