Hi Alex,
Flattery will get you everywhere, lol - except when I'm out for the
day!
|| the direc cast me.mdiparent does not work ...
Is that the one where the child is accessing the parent's StatusBar, ('cos
that works for me) or do you mean that using the same method with a different
class doesn't work?
If it's the first one, I'll need some code to see what's different between
what I've got here and what you've got.
Moving on...
If you have a separate class (I'll call it AlexFileReader) that needs to
use the StatusBar to display progress, the class needs a reference to it, or
to it's owner.
The simplest way, given that you're new to VB would be to tell the class
which StatusBar to play with. It depends where your AlexFileReader is created.
If the parent Form does this then it is very simple
In Main Form
Dim oAlexFileReader As AlexFileReader
oAlexFileReader = New AlexFileReader (Me.stBar)
In AlexFileReader
Private oStatusBar As StatusBar
Sub New (oThisStatusBar As StatusBar)
oStatusBar = oThisStatusBar
End Sub
Sub ShowProgress
oStatusBar.Text = "It's going great!!"
End Sub
If you are creating the AlexFileReader from an child Form, then you need
the full-typed reference to the main Form that we talked about earlier.
In Child Form
Dim MyMainMan As AlexesWonderfulAppForm
MyMainMan = DirectCast (Me.MdiParent, AlexesWonderfulAppForm)
Dim oAlexFileReader As AlexFileReader
oAlexFileReader = New AlexFileReader (MyMainMan.stBar)
If you are creating the AlexFileReader from a different class altogether,
then a bit more is needed. But I'm assuming that you aren't. ;-)
Regards,
Fergus