Changing the text of a statusbar panel from a class

eschulz

Newcomer
Joined
Jan 27, 2003
Messages
9
Location
Lewisville, Texas
I have a form 'frmMain' with a statusbar on it with three panels and a class 'StockClass'. In frmMain I call a sub in StockClass ConvertText(). I want to update the text in the statusbar of frmMain in the ConvertText sub in StockClass.
Right now I have this code:
Visual Basic:
 Private StockForm As New frmMain

Public Sub ConvertText()
 'update status bar   
 StockForm.staStockProgress.Panels(2).Text = "Beginning update of stock database"

End sub

Thanks in advance.
 
This line of code works for me

DirectCast(FrmMain,FrmMain).StatusBar1.Panels(1).Text="HHHH"

regards
 
Did you put the DirectCast in the class StockClass and the text changed in the form frmMain? When I tried it, the text did not change in the form.

Thanks
 
Pass in the form instance to your function and then access the status bar from it:

Visual Basic:
Public Sub ConvertText(ByVal form as Windows.Forms.Form)
'update status bar   
form.staStockProgress.Panels(2).Text = "Beginning update of stock database"
End Sub
 
Back
Top