How can I update the text form the main form StatusBar from child windows ?

Re: Newbie to WinForms by Herfried

Herfried
Wed May 18 11:22:10 CDT 2005

"spp" <spp_users@hotmail.com> schrieb:
> How can I update the text form the main form StatusBar from child windows
> ?


Assuming that your child windows are MDI children:

\\\
DirectCast(Me.MdiParent, MainForm).StatusBar1.Text = "Hello World!"
///

'MainForm' must be replaced with the type of the MDI container.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Re: Newbie to WinForms by spp

spp
Thu May 19 06:24:41 CDT 2005

Thank's
How can I do the same thing with C# ?

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> a scris în mesajul de
stiri:%23w%2387W8WFHA.3176@TK2MSFTNGP12.phx.gbl...
> "spp" <spp_users@hotmail.com> schrieb:
>> How can I update the text form the main form StatusBar from child windows
>> ?
>
>
> Assuming that your child windows are MDI children:
>
> \\\
> DirectCast(Me.MdiParent, MainForm).StatusBar1.Text = "Hello World!"
> ///
>
> 'MainForm' must be replaced with the type of the MDI container.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>



Re: Newbie to WinForms by Mehdi

Mehdi
Thu May 19 06:54:49 CDT 2005

On Thu, 19 May 2005 14:24:41 +0300, spp wrote:

> Thank's
> How can I do the same thing with C# ?

MainForm mainForm = this.MdiParent as MainForm;
if (mainForm != null)
{
mainForm.StatusBar1.Text = "Whatever";
}

Note that your status bar must be made public in MainForm for this to work.
By default, controls added in the designer are private.

Re: Newbie to WinForms by spp

spp
Thu May 19 13:02:15 CDT 2005

I forgot to say I am using VS 2005.
But I think it's something wrong with VS 2005 because the MainForn object
appears to exist in ApplicationContext class but I can't found this class in
System.Windows.Forms.
???
Any ideas ?

"Mehdi" <vioccc@REMOVEME.gmail.com> wrote in message
news:1od6jlkjlgbgt$.92uwg1hb7gks.dlg@40tude.net...
> On Thu, 19 May 2005 14:24:41 +0300, spp wrote:
>
> > Thank's
> > How can I do the same thing with C# ?
>
> MainForm mainForm = this.MdiParent as MainForm;
> if (mainForm != null)
> {
> mainForm.StatusBar1.Text = "Whatever";
> }
>
> Note that your status bar must be made public in MainForm for this to
work.
> By default, controls added in the designer are private.



Re: Newbie to WinForms by Herfried

Herfried
Thu May 19 14:34:38 CDT 2005

"spp" <spp_users@hotmail.com> schrieb:
>I forgot to say I am using VS 2005.
> But I think it's something wrong with VS 2005 because the MainForn object
> appears to exist in ApplicationContext class but I can't found this class
> in
> System.Windows.Forms.

You'll have to replace 'MainForm' with the type of your MDI container.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>