What do you mean by "activate"? You have to set the value of a ProgressBar yourself, so you can't just call a method or set a property and have it start incrementing. Every time the ProgressBar moves it's because you tell it to explicitly, by either calling PerformStep or by setting the Value property.
but what jmcilhinney was getting at, is there needs to be some REASON for using a progress bar.. most commonly a loop of some sort where you want to show progress as the loop is working
A ProgressBar is supposed to indicate the progress of an operation, so you have to set the Value property each time you want it to change. You don't just start it going and it increments itself. If you want it to show that an operation is 10% complete then you need to set the Value property to 10% of the Maximum value. If you then want it to show that an operation is 50% complete then you have to set the Value property to 50% of the Maximum. The ProgressBar knows nothing about your TabPage. You have to tell it what to display every step of the way.
Anyway, you still haven't answered my question. You say "activated" and "loading" like we're supposed to know what that means. A TabPage will display almost instantaneously, so there's no need to use a Progressbar for that. I assume that you mean that you are retrieving data from a database or something like that. If that's the case, how about you say so.
The tabpage is used to read information from an excel file. It contains a lot of labels and it can take time to load the info, there for i would like the progressbar to run until it loads. There are 8-30 tabpages that all have different info. (these tabpoages are created at run time by the user selecting the required number from a combobox)
Also as were on the topic of progressbar’s how would I use one on say form1 while form1 loads the tasbpages as above?
You would set the Value property or call the PerformStep or Increment method at various points in the code that loads your data. You need to decide what those points will be and you need to explicitly write the code that updates the ProgressBar. For instance, if your code performs 10 actions you would most likely set the Minimum and Value to 0, the Maximum to 10 and the Step to 1, then call PerformStep after each action. If each action is not considered an equal portion of the task however, you would more likely set the Maximum property to something like 100 and then call Increment to increase the Value to whatever percentage of the entire task had been completed after each action.
In my case, the solution isn't elegant, but it works really well.
I created a very simple form with just a progress bar on it that is shown immediately when my program starts. The form has one public method with a single argument, and that method is used to update the progress bar value to the supplied value. I found it necessary to Refresh the progress bar and the form every time the progress bar value was updated so that the updates would be shown to the user.
At various points in the program initiation, I update the progress bar accordingly, e.g. frmFrmLoading.subSetProgressBar(65). The "various points" and associated values with those points so that the progress bar was accurate were determined via trial and error. When initialization is complete, my main form disposes of the form with the progress bar, and the main form opens.
I use an "AppStarting" cursor on the progress bar form, and it is a FixedToolWindow.
I have attached the form to this posting in case anyone is interested.