2. Example of Code adding 20% to the progress bar…
‘mnuMain.ProgressBar1.Value += 20
3. Example of my code for Automated Invoices (Uploaded to ‘S:/’ Drive):
Sub AutomatedInvoice() mnuMain.ProgressBar1.Value = 0 'Reset Progressbar incase another invoice has already been sent… = 0 ' Excel Phase---------------------------------| OpenExcel() mnuMain.ProgressBar1.Value += 25 ‘progress = 20 mnuMain.txtProgress.Text = "Excel Open Done"'Tells when Temp.xlsx has been opened. entervalues() mnuMain.ProgressBar1.Value += 25 ‘progress = 45 mnuMain.txtProgress.Text = "Excel Values Added"'Tells when Temp.xlsx has been modified to match business. SaveAsNewExcel() 'sub -30 mnuMain.ProgressBar1.Value += 25 ‘progress = 70 ' Email Phase---------------------------------| mnuMain.txtProgress.Text = " Excel Save Done, Preparing to send Email" Email() 'Make Email And Attach our Recently made invoice… mnuMain.Progressbar1.Value += 25 ‘progress = 100, Email Takes the longest so a progess of 25 is ok for an example, better code would have the email phase split into parts and each complete part would modify the progress bar. 'mnuMain.txtProgress.Text = "Email Send!" Messagebox.show("Email Sent!") 'just here for an example End Sub
Hint 2: Like the Above Code, I used a textbox on the mainForm (textbox is disabled, but visible) I have mnuMain.txtProgress.Text set in the other Sub Forms so I can see exactly where it is upto, and where it is if it fails (mostly email Errors, when uploading larger files)
Make a textbox to the mainForm/Form1.vb, and then set the txtProgressbar.Text = to Different things in the stages of your Programs Operation.
And yes, my code is a sub form, running other sub forms.
Cameron Greck
Hint 1:
Using Progress Bars
1. Draw a progress bar on your main form/Form1.vb
2. Example of Code adding 20% to the progress bar…
‘mnuMain.ProgressBar1.Value += 20
3. Example of my code for Automated Invoices (Uploaded to ‘S:/’ Drive):
Sub AutomatedInvoice()
mnuMain.ProgressBar1.Value = 0 'Reset Progressbar incase another invoice has already been sent… = 0
' Excel Phase---------------------------------|
OpenExcel()
mnuMain.ProgressBar1.Value += 25 ‘progress = 20
mnuMain.txtProgress.Text = "Excel Open Done" 'Tells when Temp.xlsx has been opened.
entervalues()
mnuMain.ProgressBar1.Value += 25 ‘progress = 45
mnuMain.txtProgress.Text = "Excel Values Added" 'Tells when Temp.xlsx has been modified to match business.
SaveAsNewExcel() 'sub -30
mnuMain.ProgressBar1.Value += 25 ‘progress = 70
' Email Phase---------------------------------|
mnuMain.txtProgress.Text = " Excel Save Done, Preparing to send Email"
Email() 'Make Email And Attach our Recently made invoice…
mnuMain.Progressbar1.Value += 25 ‘progress = 100, Email Takes the longest so a progess of 25 is ok for an example, better code would have the email phase split into parts and each complete part would modify the progress bar.
'mnuMain.txtProgress.Text = "Email Send!"
Messagebox.show("Email Sent!") 'just here for an example
End Sub
Hint 2: Like the Above Code, I used a textbox on the mainForm (textbox is disabled, but visible) I have mnuMain.txtProgress.Text set in the other Sub Forms so I can see exactly where it is upto, and where it is if it fails (mostly email Errors, when uploading larger files)
Make a textbox to the mainForm/Form1.vb, and then set the txtProgressbar.Text = to Different things in the stages of your Programs Operation.
And yes, my code is a sub form, running other sub forms.