PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Re: Accesing StatusBar

Reply

Re: Accesing StatusBar

 
Thread Tools Rate Thread
Old 26-06-2003, 08:19 AM   #1
Sorin Sandu
Guest
 
Posts: n/a
Default Re: Accesing StatusBar


I need in C# please.


  Reply With Quote
Old 26-06-2003, 10:34 AM   #2
Ian Cooper
Guest
 
Posts: n/a
Default Re: Re: Accesing StatusBar

> I need in C# please.
If you used the designer you will find that the StatusBar member of your MDI parent form is private i.e.:
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.StatusBar statusBar1;
....
so you want to add an accessor to MainForm to expose it
public StatusBar MainFormStatusBar
{
get {return statusBar1 ;}
}

then from a MDI child form you can just get hold of it by doing:
MainForm mainForm = (MainForm) this.MdiParent ;
StatusBar sb = mainForm.MainFormStatusBar ;

which you can shorten to
StatusBar sb = ((MainForm) this.MdiParent).MainFormStatusBar ;
if you prefer
HTH,

Ian Cooper
wwww.dnug.org.uk
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off