-
Sep 13th, 2017, 02:27 AM
#1
Thread Starter
Frenzied Member
Correct way to use a progress bar?
Hi,
I include a progress bar in my project and it is like this:
Code:
code
code
code
Me.ProgressBar.Value = 10
code
code
code
Me.ProgressBar.Value = 20
code
code
code
Me.ProgressBar.Value = 30
etc.
So my code is run back and forth which means the progress bar also jumping back and forth.. and it looks stupid..
If I add a timer for progress bar then i think the progress bar is only for "fancy" and is not really show progress of code..
My code is make copy of records and sometimes can make 1 minute to complete.. What is best way to implement progress bar? Also, when I press save button because of slow network can take some time to complete save, maybe 30 seconds and for during such time i wish to display progress bar..
Thank you
-
Sep 13th, 2017, 03:15 AM
#2
Re: Correct way to use a progress bar?
The point of displaying progress is that it is a measure of the completion of a task. If there's no measuring then you can't really provide meaningful progress. In that case, you can set the Style property to Marquee and the ProgressBar will animate continuously, indicating that something is happening but not where it is actually up to.
If you can measure the progress then do so. For instance, if you're progressing all the files in a folder then get the file count and assign that to the Maximum of the ProgressBar. You can then increment the progress by 1 each time you process a file and the control will display meaningful progress. In that case, you would likely set the Step to 1 and call PerformStep each time rather than setting the Value.
You might also be in a situation where you have multiple steps to perform that don't take the same amount of time. In such cases, you should do some testing to determine how the steps usually behave and code accordingly. For instance, let's say that you have three steps to perform and the second one takes twice as long as the first one and the fourth one takes four times as long as the first. In that case, you could set the Maximum to 7 and then set the Value to 1, 3 and 7 after the first, second and third steps respectively.
To be honest, most of this is information that can be easily found with a reading of the documentation for the ProgressBar class. History tells me that you didn't do that though. Am I right?
It's also worth noting that if you are doing this all from within a single method on the UI thread then I don't think that the control will update until that method completes. You would need to call Application.DoEvents or the Refresh method of the control after each change to force it. That said, doing the work on a secondary thread would be preferable to that, in which case you'd need to marshal to the UI thread to update the control. Using a BackgroundWorker is an easy way to do that.
-
Sep 13th, 2017, 03:34 AM
#3
Thread Starter
Frenzied Member
Re: Correct way to use a progress bar?
To be honest, most of this is information that can be easily found with a reading of the documentation for the ProgressBar class. History tells me that you didn't do that though. Am I right?
Again, history tells me that you are making assumptions without any facts to back it up. It is impossible for you to know what I did, or did not do in order to gain knowledge and understanding on the subject prior to posting on vbForums.
I did read up and I already experiment with blocks, marquee and continuous styles. I also experiment with animation speed, etc, etc.
My question is about indicating real progress. You did not get that. Am I right?
Also, sometimes I prefer to interact with people on vbforums and I don't think you have the right to tell people otherwise.. If vbForums is my preference then you don't get to decide something else..
But having responded to you usual ranting, thank you for your time and answer. I notice you try to tone it down lately... (must be hard for you...)
I have not heard about background worker before..
-
Sep 13th, 2017, 04:33 AM
#4
Re: Correct way to use a progress bar?
Originally Posted by schoemr
Again, history tells me that you are making assumptions without any facts to back it up. It is impossible for you to know what I did, or did not do in order to gain knowledge and understanding on the subject prior to posting on vbForums.
I've got facts all right. There are numerous occasions in the past that you haven't done appropriate research. As you say, it's impossible for me to know whether that's the case on this occasion, which is why I asked.
Originally Posted by schoemr
I did read up and I already experiment with blocks, marquee and continuous styles. I also experiment with animation speed, etc, etc.
And yet there's nothing about your having tried any of that in your post.
Originally Posted by schoemr
My question is about indicating real progress. You did not get that. Am I right?
You are wrong. Why would I have provided an answer to that question if I didn't get it? That said, measuring progress has exactly zero to do with a ProgressBar. A ProgressBar is simply a visual representation of a ratio. How you calculate that ratio is of no consequence to the ProgressBar and completely dependent on the process whose progress you want to represent.
Originally Posted by schoemr
Also, sometimes I prefer to interact with people on vbforums and I don't think you have the right to tell people otherwise.. If vbForums is my preference then you don't get to decide something else..
If I think that there's a best way for someone to get the information they want then I'm going to tell them that. If you don't like what I post then you're free to ignore it but it seems rather ironic that you seem to be trying to tell me what I can and can't post while telling me that I can't tell you the same.
Originally Posted by schoemr
But having responded to you usual ranting, thank you for your time and answer. I notice you try to tone it down lately... (must be hard for you...)
I've made no particular effort either way. I post what I feel like posting at any particular time. Maybe you haven't been quite as frustrating lately. It's most likely that I haven't posted more than once or twice to any of your threads lately. It was usually when you repeatedly failed to grasp something that I considered to be simple or obvious that I felt like posting something a bit more strident.
Originally Posted by schoemr
I have not heard about background worker before..
Then you have learned something useful. You're welcome.
-
Sep 13th, 2017, 05:06 AM
#5
Thread Starter
Frenzied Member
Re: Correct way to use a progress bar?
There are numerous occasions in the past that you haven't done appropriate research. As you say, it's impossible for me to know whether that's the case on this occasion, which is why I asked.
Seems you have issues of letting go of past experiences...... You should talk to someone. You can for even talk to me John, maybe you feel better....All that anger bottled up inside is not good for you..
measuring progress has exactly zero to do with a ProgressBar
If I think that there's a best way for someone to get the information they want then I'm going to tell them that.
Okay, that is fair. But if I decide not to read any documentation or do no research before coming to vbForums, it is still MY decision to make - not yours. You can only decide to respond, or not. (even though you only respond to easy questions I see, the hard once jmc shines in absence...)
I felt like posting something a bit more strident.
I had to google that word, but was almost fall of my chair of laughing.. Strident...very funny, but I think you are confusing condescending for strident..
-
Sep 13th, 2017, 06:41 AM
#6
Re: Correct way to use a progress bar?
Originally Posted by schoemr
Seems you have issues of letting go of past experiences......
So, the fact that I remember something that happened in the past means that I'm holding on to it?
Originally Posted by schoemr
All that anger bottled up inside is not good for you..
But it's not bottled up. Have you not noticed that I let it out if I feel it?
Originally Posted by schoemr
What's to be confused about? If you perform a calculation and display the result in a TextBox, does the TextBox have anything to do with the calculation? Of course not. So, if you perform a calculation and display the result in a ProgressBar, why would the ProgressBar have anything to do with the calculation?
Originally Posted by schoemr
Okay, that is fair. But if I decide not to read any documentation or do no research before coming to vbForums, it is still MY decision to make - not yours. You can only decide to respond, or not.
That's true, and I will respond how I choose. That said, if you refuse to do appropriate research before posting a question, do you really have grounds to complain when someone calls you lazy? It's your prerogative to be lazy if you want to, as you say, but if you're going to reserve the right to be lazy then why get upset when it's pointed out that you're partaking of that right? You can't really have it both ways.
Originally Posted by schoemr
(even though you only respond to easy questions I see, the hard once jmc shines in absence...)
It seems like every question is a hard one for you so I'm not sure how you can tell the difference but your point is not without merit. I generally visit this site when I don't have a lot of time on my hands so I generally don't have the time to spend on subjects that I don't already have some specific experience with or would take significant time to solve. When I do have the time and inclination though, I will tackle those questions. It's not really about that though, is it? Are you trying to convince yourself that I'm not capable of answering more difficult questions? If that makes you feel better, you go with that.
Originally Posted by schoemr
I had to google that word, but was almost fall of my chair of laughing.. Strident...very funny, but I think you are confusing condescending for strident..
Not at all. Is there any reason my comments couldn't be both? Of course, there are plenty of people to whom I've never condescended to. Have you ever considered that, if you feel condescended to, it might say something about you? I'm guessing not. That doesn't mean that it's not the case though.
-
Sep 13th, 2017, 06:51 AM
#7
Thread Starter
Frenzied Member
Re: Correct way to use a progress bar?
Oh, John, let us just finish this off with me thanking you for throwing in a "Backgroundworker" between all the noise from your side... It almost bedtime for you. Don't forget to brush teeth, k?
-
Sep 13th, 2017, 07:23 AM
#8
Lively Member
Re: Correct way to use a progress bar?
You guys are so funny. It's like watching a movie. Would like to put you two in a room, working together on a project. Now that would be something new
-
Sep 13th, 2017, 07:34 AM
#9
Re: Correct way to use a progress bar?
Originally Posted by BlackRiver1987
You guys are so funny. It's like watching a movie. Would like to put you two in a room, working together on a project. Now that would be something new
+1. I was going to say they should be married.
-
Sep 13th, 2017, 07:35 AM
#10
Re: Correct way to use a progress bar?
Can y'all just knock it off and get back to the problem at hand? It's like watching an old married couple bicker and nothing is getting solved.
schoemr - you're right. if you don't want to read the documentation and come straight here, that's your prerogative. It's also our prerogative to not help in those cases. If you can't be bothered to take the time to research the documentation, why should we? You're not paying us to be research monkeys. Some of us older types started this back when there was no internet so books and documentation was all we had, so yeah, sometimes we have a bit of a chip on our shoulder sometimes when we see someone trying to take shortcuts. God forbid should something happen to the internet one day and it's not there. Millions of programmers aren't going to know what to do. Only a few hundred will.
John - geezes... let it go. Don't you know when to just shut up and walk away? If someone's irritated you before, then why insist on trying to help them again? I've got a short (but quite distinguished) list in my head of posters I'll never help again. It has saved me a lot of grief.
both of you - quit being so stubborn and taking things personally. If you can't then maybe y'all should stay out of each other's posts.
-tg
-
Sep 13th, 2017, 07:37 AM
#11
Re: Correct way to use a progress bar?
Originally Posted by BlackRiver1987
You guys are so funny. It's like watching a movie. Would like to put you two in a room, working together on a project. Now that would be something new
Thanks... I almost spit out my drink laughing at that... I'd buy tickets to see that.
Originally Posted by topshot
+1. I was going to say they should be married.
Originally Posted by techgnome
Can y'all just knock it off and get back to the problem at hand? It's like watching an old married couple bicker and nothing is getting solved.
I went further with it... and OLD married couple...
-tg
-
Sep 13th, 2017, 08:04 AM
#12
Re: Correct way to use a progress bar?
Originally Posted by techgnome
Can y'all just knock it off and get back to the problem at hand? It's like watching an old married couple bicker and nothing is getting solved.
schoemr - you're right. if you don't want to read the documentation and come straight here, that's your prerogative. It's also our prerogative to not help in those cases. If you can't be bothered to take the time to research the documentation, why should we? You're not paying us to be research monkeys. Some of us older types started this back when there was no internet so books and documentation was all we had, so yeah, sometimes we have a bit of a chip on our shoulder sometimes when we see someone trying to take shortcuts. God forbid should something happen to the internet one day and it's not there. Millions of programmers aren't going to know what to do. Only a few hundred will.
John - geezes... let it go. Don't you know when to just shut up and walk away? If someone's irritated you before, then why insist on trying to help them again? I've got a short (but quite distinguished) list in my head of posters I'll never help again. It has saved me a lot of grief.
both of you - quit being so stubborn and taking things personally. If you can't then maybe y'all should stay out of each other's posts.
-tg
This post reminds me of how occasionally people at work accidentally hit reply all to a large email distribution list. Then people start replying to the whole distribution saying stop replying to all. It escalates to people sending out emails yelling "STOP REPLYING ALL" to everyone.
The best thing is to ignore the original email and move on.
Last edited by TysonLPrice; Sep 13th, 2017 at 08:21 AM.
Please remember next time...elections matter!
-
Sep 13th, 2017, 08:18 AM
#13
Re: Correct way to use a progress bar?
#1 problem people stumble into with ProgressBar: it generally doesn't work unless used in conjunction with asynchronous programming.
Number of times the ProgressBar documentation mentions this: 0.
I think those two facts are part of why we get a question about the ProgressBar every week. I'm writing a form-letter response today so hopefully I can intercept before this happens again. I wish we'd publish the list of questions that make users "fair game" for abuse.
It's much quicker and easier to:
- Skip answering questions if you find the user frustrating.
- Keep a set of links on speed-dial with examples and form-letter posts for common problems.
- Treat people with respect.
- Reconsider the logic behind attacking people for asking a question on a forum for asking VB questions, particularly "stupid" ones.
- Buy yourself a nice coffee or donut or something when you feel grouchy. Be Dale Cooper, not Albert Rosenfield.
This answer is wrong. You should be using TableAdapter and Dictionaries instead.
-
Sep 13th, 2017, 08:54 AM
#14
Re: Correct way to use a progress bar?
Originally Posted by Sitten Spynne
#1 problem people stumble into with ProgressBar: it generally doesn't work unless used in conjunction with asynchronous programming.
Oh I don't know about that... I've gotten the PB to work just fine in highly linear fashion before. In fact, that's typically when I do use it... I know that I have 10,000 lines to process in a file... min=0, max=100, every 100 lines I increment the value.
Where I think it falls flat is that it's a UI component, which is always a low priority update item. So then we get the PB that jerks or does nothing, then suddenly updates at the very end (oddly, now that I think about it, that's the same behavior I've seen in some installers lately...huh).
Anyways, I think the problem Shoemr might be having is setting the value to 10, 20, 30 may be getting called in a loop so it is going 10, 20, 30, 10, 20, 30, 10, 20, 30... and so on. But we may never know now.
-tg
-
Sep 13th, 2017, 09:48 AM
#15
Re: Correct way to use a progress bar?
Hi @ll,
I'll try to be Switzerland ;-))
I took a look at the Docs. and some samples that are out there (including Backgroundworker).
Is it really necessary to use a Backgroundworker ?
to use the Progressbar I need a Max Value, Min is 0
well here a sample Loading some Data to the Datagridview and showing a ProgressBar
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strSql As String
strSql = "SELECT * From Tabelle1 "
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=D:\Northwind.mdb")
Dim cmd As OleDbCommand = New OleDbCommand(strSql, con)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "MyT")
Dim rowCount As Integer = myDataSet.Tables("MyT").Rows.Count 'Max Value
' MsgBox(rowCount) just Check the Number
Dim i As Integer
For i = 0 To rowCount - 1
ProgressBar1.PerformStep()
If ProgressBar1.Value = rowCount Then
End If
Next
DataGridView1.DataSource = myDataSet.Tables("MyT").DefaultView
ProgressBar1.Value = 0
con.Close()
con = Nothing
End Sub
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
-
Sep 13th, 2017, 09:57 AM
#16
Re: Correct way to use a progress bar?
Originally Posted by ChrisE
Is it really necessary to use a Backgroundworker ?
No, but you generally shouldn't be doing heavy processing on the UI thread. Generally speaking, a control won't update while the UI thread is busy doing something else. I wasn't 100% sure that the ProgressBar was like that, which is why I said "I don't think that the control will update". It turns out that it does, but it's still good practice to get that processing off the UI thread, which the BackgroundWorker makes easier.
-
Sep 13th, 2017, 10:03 AM
#17
Re: Correct way to use a progress bar?
Originally Posted by jmcilhinney
No, but you generally shouldn't be doing heavy processing on the UI thread. Generally speaking, a control won't update while the UI thread is busy doing something else. I wasn't 100% sure that the ProgressBar was like that, which is why I said "I don't think that the control will update". It turns out that it does, but it's still good practice to get that processing off the UI thread, which the BackgroundWorker makes easier.
yes that makes sence, for example large Filedownloads. I haven't used the Backgroundworker so it's on my
ToDo list
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
-
Sep 13th, 2017, 10:52 AM
#18
Re: Correct way to use a progress bar?
My opinion is that the boxed progress bar leaves much to be desired. Like many MS controls it leaves you hanging on simple features... like ... a text property....
... a text property... i mean... uh..... yea...
Anyway, it looks like it's been covered how to use one. now all you need is one that has all the features you would expect from a progress bar...
https://code.msdn.microsoft.com/wind...ssBar-a68b61de
-
Sep 13th, 2017, 11:31 AM
#19
Hyperactive Member
Re: Correct way to use a progress bar?
Hi,
A while a go i did a litle tool to backup my VS projects and i used a progressbar with a backgroundworker, the solution i found was this:
Code:
Private FLDINFO As New DirectoryInfo(My.Settings.PRGDFTFOLDER)
Private Sub BACKUPPRGSBT_Click(sender As Object, e As EventArgs) Handles BACKUPPRGSBT.Click
If Not BCKWRM.IsBusy = True Then
BCKWRM.RunWorkerAsync(FLDINFO.GetDirectories.Count)
PRGSBAR.Value = 0
PRGSBAR.Maximum = FLDINFO.GetDirectories.Count
End If
End Sub
Private Sub BCKWRM_DoWork(sender As Object, e As DoWorkEventArgs) Handles BCKWRM.DoWork
Dim BCKPATH As String = My.Settings.BCKDFTFOLDER & Now.ToFileTimeUtc
If Directory.Exists(BCKPATH) = False Then
Directory.CreateDirectory(BCKPATH)
Using SWR As StreamWriter = File.CreateText(String.Format("{0}\{1}", BCKPATH, "BackupLog.log"))
Try
For Each FLD In FLDINFO.GetDirectories
My.Computer.FileSystem.CopyDirectory(FLD.FullName, String.Join("\", BCKPATH, FLD.Name))
SWR.WriteLine(String.Format("Copy: {0} to {1}\{2} = Ok", FLD.FullName, BCKPATH, FLD.Name))
BCKWRM.ReportProgress(1)
Next
SWR.WriteLine("Backup complete with success.")
SWR.WriteLine(Now.ToString)
Catch ex As Exception
MessageBox.Show(ex.Message & vbNewLine & ex.Data.ToString)
SWR.WriteLine("Error...")
SWR.WriteLine("Message: " & ex.Message)
SWR.WriteLine("Data: " & ex.Data.ToString)
End Try
End Using
End If
End Sub
Private Sub BCKWRM_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BCKWRM.RunWorkerCompleted
MessageBox.Show("Backup complete!", "Backup my VS projects...", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub BCKWRM_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BCKWRM.ProgressChanged
Invoke(Sub()
PRGSBAR.PerformStep()
End Sub)
End Sub
-
Sep 13th, 2017, 11:36 AM
#20
Re: Correct way to use a progress bar?
Here is a nice example I used as an example of a progressbar run from a background worker:
http://www.vbforums.com/showthread.p...ckgroundWorker
Please remember next time...elections matter!
-
Sep 13th, 2017, 11:57 AM
#21
Re: Correct way to use a progress bar?
Originally Posted by Mike Storm
Hi,
A while a go i did a litle tool to backup my VS projects and i used a progressbar with a backgroundworker, the solution i found was this:
Code:
Private FLDINFO As New DirectoryInfo(My.Settings.PRGDFTFOLDER)
Private Sub BACKUPPRGSBT_Click(sender As Object, e As EventArgs) Handles BACKUPPRGSBT.Click
If Not BCKWRM.IsBusy = True Then
BCKWRM.RunWorkerAsync(FLDINFO.GetDirectories.Count)
PRGSBAR.Value = 0
PRGSBAR.Maximum = FLDINFO.GetDirectories.Count
End If
End Sub
Private Sub BCKWRM_DoWork(sender As Object, e As DoWorkEventArgs) Handles BCKWRM.DoWork
Dim BCKPATH As String = My.Settings.BCKDFTFOLDER & Now.ToFileTimeUtc
If Directory.Exists(BCKPATH) = False Then
Directory.CreateDirectory(BCKPATH)
Using SWR As StreamWriter = File.CreateText(String.Format("{0}\{1}", BCKPATH, "BackupLog.log"))
Try
For Each FLD In FLDINFO.GetDirectories
My.Computer.FileSystem.CopyDirectory(FLD.FullName, String.Join("\", BCKPATH, FLD.Name))
SWR.WriteLine(String.Format("Copy: {0} to {1}\{2} = Ok", FLD.FullName, BCKPATH, FLD.Name))
BCKWRM.ReportProgress(1)
Next
SWR.WriteLine("Backup complete with success.")
SWR.WriteLine(Now.ToString)
Catch ex As Exception
MessageBox.Show(ex.Message & vbNewLine & ex.Data.ToString)
SWR.WriteLine("Error...")
SWR.WriteLine("Message: " & ex.Message)
SWR.WriteLine("Data: " & ex.Data.ToString)
End Try
End Using
End If
End Sub
Private Sub BCKWRM_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BCKWRM.RunWorkerCompleted
MessageBox.Show("Backup complete!", "Backup my VS projects...", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub BCKWRM_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BCKWRM.ProgressChanged
Invoke(Sub()
PRGSBAR.PerformStep()
End Sub)
End Sub
The only comment I have on that is that it shouldn't be necessary to use the Invoke on the ProgressChanged event... that event should be raised on the main event in the first place. RunWorkerCompleted and ProgressChanged both should be back on the main thread. Only DoWork actually runs on the secondary thread.
I guess I have two comments... In addition, you should only invoke IF it's necessary, which means you should be checking to see if the Invoke is needed first before using it. It shouldn't be used blindly.
-tg
-
Sep 13th, 2017, 12:02 PM
#22
Hyperactive Member
Re: Correct way to use a progress bar?
I went back, just tested your sugestion and it works, but i do remember that when i did that project i was having some trouble geting the progressbar to performstep, i wonder what i was doing wrong.
Thanks m8.
Last edited by Mike Storm; Sep 13th, 2017 at 12:06 PM.
-
Sep 14th, 2017, 01:18 AM
#23
Thread Starter
Frenzied Member
Re: Correct way to use a progress bar?
Hi all,
I was not to beat a dead horse here but some comments was made for which I feel i must respond.
techgnome
I have never, not even once time come to vbForums asking questions if I was not prepared to resolve that for myself firstly. There are many, many sources of information on the internet and I usually search many websites. But coming to vbForums is always turns out to be a battlefield where some guys seem to think that they have the right to tell other people that they are LAZY because he/she did not read some documentation. My understand is this is a forum about visual basic where people are ALLOWED to ask questions ABOUT visual basic.
Many times I see (especially new people) are being abused on this website for their lack of knowledge or experience. Personally I can reality post many links here where a certain individual was extremely aggressive, rude and abusive towards me and for some reason that has go 'unchecked' because 'that is just the way he is' - that is nonsense. No person has the right to abuse another person. Sometimes I get PM's where people say they agree but for some reason they never show support in open forum. Maybe they are afraid for they may not get help in future, or maybe it is some "guy code" at play here.. - and this is where I am not afraid, If I have some problem and no one wants to help me, then so be it...
I am sorry some of you older guys had to learn 'the hard way' where you was to consult 'books' and 'documents' and at the time before so much information was available on the net. Nowadays there a literally millions of vb websites and tutorials available. Somewhere I was read the programmer of today is a dying specie because in the future everything will be just drag and drop and it works.. Some other professions will also become extinct but now I am off topic. The point I was making is that when I (being the normal, learner, rookie out there) have a problem or question there are many course of action that can be taken to resolve it. I have see many, many times here on vbForums (and I can prove that) where a person is (a) Attacked for asking a question (b) Told to go "Google" the answer. There is even one instance where a new user got mad for he said something like "but I googled and that is how I got here!" I will not let some pompous guy tell me I am lazy because he don't know the first thing about me. I take on many thing in my life and just because I am learn this vb now does not give a person the right to make judgement/insults on my personality, my work ethic or my values and beliefs.
Also, tell me, why are you here? Why are you answering questions? free of charge no less..? My thinking is that there are people that WANTS to help other people. It is something that gives you good feeling to be able to share your knowledge, and in same time you also expand your knowledge. Now If you constantly get upset and angry when people ask question do you still find joy in helping people? At the end of the day is everything we do and experience not about fellow human beings trying to make the world a better place? Some people listen to you so that they can answer. They don't listen to you so that they can understand. It is a sickness where listening skills has become rare in our society and we are ending up with oversupply of talking skills. A person asks a question and the "answerer" gets frustrated because he answer that question last month. Then someone else comes here ask same question, then get more frustrated, and guess what? next month another person is come ask same question then is furious because why are "they" (the stupid people out there) not listening!!....
Anyways, I think the problem Shoemr might be having is setting the value to 10, 20, 30 may be getting called in a loop so it is going 10, 20, 30, 10, 20, 30, 10, 20, 30... and so on
Yes exactly that was happens now. My code is making a copy of a record and that record consist of 4 related tabled. So the code is long, maybe about two pages. Because this takes about 1 min to complete I wanted to show user that she must wait by means of a progress bar. But right now this progress bar left me with some unwanted emotions so I am not sure want to do that anymore
Thank you to other people here for your links and code
-
Sep 14th, 2017, 03:32 AM
#24
Re: Correct way to use a progress bar?
Originally Posted by schoemr
Many times I see (especially new people) are being abused on this website for their lack of knowledge or experience.
I can't speak for others but noone has ever been abused by me for lack of knowledge or experience. Personally, I don't think that anyone has been abused by me for anything here. They may well have been criticised for lack of effort though. If being called lazy, either directly or indirectly, when you're being lazy is being abused then I think that that's a rather low bar. I guess different people draw the line between criticism and abuse in different places and those being criticised often draw it very quickly. There are those who think that no criticism has a place on a forum like this. Those people are entitled to that opinion. I don't share it. If my position breaks some rules then I'll suffer the consequences of that.
-
Sep 14th, 2017, 05:41 AM
#25
Re: Correct way to use a progress bar?
Originally Posted by schoemr
... Somewhere I was read the programmer of today is a dying specie because in the future everything will be just drag and drop and it works..
I don't know if I would worry about it. In the late 1970's when I told my dad I was interested in programing computers he talked with a corporate programmer at the company where he worked (he was a commercial pilot for the company) and the programmer told him that it would be a job without much future in it as they would soon have programs that would automate the writing of the software based on the end user using tools to specify the requirements of the software. The death of the software programmer has been "greatly exaggerated" and anticipated for at least 40 years at this point.
But I program because I enjoy it. Being paid for it has been a long and fairly constant side benefit.
-
Sep 14th, 2017, 07:21 AM
#26
Re: Correct way to use a progress bar?
If being called lazy, either directly or indirectly, when you're being lazy is being abused then I think that that's a rather low bar.
I totally agree with this, that said he never even called her lazy... he may as much as "called her out" on lack of effort, but at no point do I see where he called her anything at all.
-
Sep 14th, 2017, 08:28 AM
#27
Re: Correct way to use a progress bar?
Originally Posted by schoemr
Hi all,
-snipped-
All I'll say to that chunk there is - unless you tell us what you did/didn't do or tried, we don't know. If you looked at the documentation, tried what was there and still didn't get the expected results... then say so. At least then no one will be able to make the assumption you didn't read it. IF you searched and tried a couple things, say so. Include the snips you tried that didn't work... that shows an effort. That's all that's being asked for.
Originally Posted by schoemr
Yes exactly that was happens now. My code is making a copy of a record and that record consist of 4 related tabled. So the code is long, maybe about two pages. Because this takes about 1 min to complete I wanted to show user that she must wait by means of a progress bar. But right now this progress bar left me with some unwanted emotions so I am not sure want to do that anymore
Thank you to other people here for your links and code
All other issues aside, I think your best bet is to put the PB into marquee mode, start it, and just let it do it's thing until you're done. Don't change the value or try to do a performstep or anything...
And it is super simple... ProgressBar1.Style = ProgressBarStyle.Marquee ... as soon as you change it to Marquee style, it will start moving. You can also change the MarqueAnimationSpeed if you want. To get it to stop, change the style back to ProgressBarStyle.Block. And boom, you're done.
-tg
-
Sep 14th, 2017, 10:20 AM
#28
Re: Correct way to use a progress bar?
I think your best bet is to put the PB into marquee mode, start it, and just let it do it's thing until you're done
It's probably worth mention that you could also use the wait cursor instead or in conjunction with the marque.
Code:
Cursor = Cursors.WaitCursor
'do stuff
Cursor = Cursors.Default
-
Sep 15th, 2017, 06:03 AM
#29
Re: Correct way to use a progress bar?
Glad to see that this thread has got back on track but I'd like to post something that I'd like you all to consider:-
We WANT people to post questions here and we want to see answers. That includes dumb questions and it includes questions where they haven't done the initial research. Every question that gets asked and answered on this site adds to it's value. It makes it that bit more likely that the next person who googles for how to use a progress bar ends up here instead of somewhere else.
While referring someone to MSDN is a valid answer to a question, trying to discourage the poster from asking the question at all if the answer could be found elsewhere actually devalues this site. Please don't do it.
I genuinely don't know if Schoemr checked the documentation before posting and I don't really care. I'm glad she felt able to ask her question and I'm glad that several of the members in this thread have responded with valuable information. That information will help Schoemr, it will help the next person with a similar issue and it will help this site stay lively and vibrant.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
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
|