|
-
Apr 24th, 2004, 10:47 AM
#1
Thread Starter
Lively Member
Controlling a progress bar.
How can I control a progress bar on my form from another class I created?
For example, my main form calls a function in another class called SectionLister and in that class I have calls to other functions in another class called SubSectionLister. SectionLister figures out how many subsections it needs to parse using a hashtable with subsection URLs in it, and I want to be able to set the progress bar to the number of entries in the hashtable, then move the bar each time SubsectionLister.List is called with a value from the hashtable.
So I tried to Dim progressbar as formMain.progressBar1 but I can't. What's the right way to do this?
-
Apr 24th, 2004, 11:31 AM
#2
Pass the progressbar into the function as a parameter.
VB Code:
'in class
Dim _progressBar As ProgressBar
Public Sub DoSomething(ByVal progressBar As ProgressBar)
_progressBar=progressBar
_progressBar.Value+=1
End Sub
'in calling form
Dim t As New Test
t.DoSomething(Me.ProgressBar1)
-
Apr 24th, 2004, 12:27 PM
#3
Thread Starter
Lively Member
You are the f***ing MAN! I had to pass it to a function that already took a parameter but I didn't realize I could pass it as an additional one.
VB Code:
ElseIf sectionSelected = 2 Then
gamesTable = sectionLister.List(gamesUrl, Me.mainBar)
gridMain.DataSource = gamesTable
That works just fine. I also had to step the bar from within the for loop I have that iterates over the hashtable in the sectionLister.List function and that worked like a charm. I LOVE VB.NET!!!
WOOHOO!
Peace,
KT
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
|