473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

status bar

Ada
i have a little bit of issue getting the status bar to work properly.
this is what happens now.

when the program loaded, the status is "READY..."
the code is inside the FORM LOAD.

i also added the same code in another CLICK METHOD.
everytime i click, the status got updated but the old "READY..." got moved up one line above.
so, if i click 10 times, i got a stack of 10 rows of status bar.

the question is.......
how do i destroy the old status bar and update the new info and leaving it at the same position?
thanks in advance,
Ada


Nov 15 '05 #1
6 2968
Hi Ada,

Typically, the StatusBar.Text or the StatusBarPanel.Text property (if using
panels
in the status bar) should take care of updating the status bar text.
Can you post a snippet of code in your Click handler that
updates the status bar text ?.
That will help us track down the cause of the issue

Regards,
Aravind C
"Ada" <an*******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
i have a little bit of issue getting the status bar to work properly.
this is what happens now.

when the program loaded, the status is "READY..."
the code is inside the FORM LOAD.

i also added the same code in another CLICK METHOD.
everytime i click, the status got updated but the old "READY..." got moved up one line above. so, if i click 10 times, i got a stack of 10 rows of status bar.

the question is.......
how do i destroy the old status bar and update the new info and leaving it at the same position?

thanks in advance,
Ada

Nov 15 '05 #2
Ada
hi AC

below is the snippet
note, this is the exact same code in MSDN

// // Create a StatusBar control
// StatusBar statusBar1 = new StatusBar()
/
// StatusBarPanel panel1 = new StatusBarPanel()

// panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken
// // Initialize the text of the panel
// panel1.Text = "Ready..."
// // Set the AutoSize property to use all remaining space on the StatusBar
// panel1.AutoSize = StatusBarPanelAutoSize.Spring
//
// // Display panels in the StatusBar control
// statusBar1.ShowPanels = true
//
// statusBar1.Panels.Add(panel1)
//
/
// // Add the StatusBar to the form
// this.Controls.Add(statusBar1)

----- Aravind C wrote: ----

Hi Ada

Typically, the StatusBar.Text or the StatusBarPanel.Text property (if usin
panel
in the status bar) should take care of updating the status bar text
Can you post a snippet of code in your Click handler tha
updates the status bar text ?
That will help us track down the cause of the issu

Regards
Aravind
"Ada" <an*******@discussions.microsoft.com> wrote in messag
news:CC**********************************@microsof t.com..
i have a little bit of issue getting the status bar to work properly
this is what happens now
when the program loaded, the status is "READY... the code is inside the FORM LOAD
i also added the same code in another CLICK METHOD

everytime i click, the status got updated but the old "READY..." got move

up one line above so, if i click 10 times, i got a stack of 10 rows of status bar
the question is......

how do i destroy the old status bar and update the new info and leaving i

at the same position
thanks in advance Ad

Nov 15 '05 #3
Hi Ada,

From what I undestand, in your Click handler, you call the
snippet of code that you posted. Correct ?.

Actually, you must call the code that creates and adds the
status bar to the form's control collection only once -
prefeably in the designer generated InitializeComponent()
called in the Form's Constructor or in Form's Load event handler.
Otherwise we would end up creating and adding multiple instances of the
status bar to the windows form - which explains the behavior
you're seeing with the status bars being stacked one on top of another.

For updating the status bar's text, it may be enough to call,
panel1.Text = "....some text ...."; in your Click handler.

Regards,
Aravind C
"Ada" <an*******@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
hi AC,

below is the snippet.
note, this is the exact same code in MSDN.
// // Create a StatusBar control.
// StatusBar statusBar1 = new StatusBar();
//
// StatusBarPanel panel1 = new StatusBarPanel();

// panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;
// // Initialize the text of the panel.
// panel1.Text = "Ready...";
// // Set the AutoSize property to use all remaining space on the StatusBar. // panel1.AutoSize = StatusBarPanelAutoSize.Spring;
//
// // Display panels in the StatusBar control.
// statusBar1.ShowPanels = true;
//
// statusBar1.Panels.Add(panel1);
//
//
// // Add the StatusBar to the form.
// this.Controls.Add(statusBar1);


----- Aravind C wrote: -----

Hi Ada,

Typically, the StatusBar.Text or the StatusBarPanel.Text property (if using panels
in the status bar) should take care of updating the status bar text.
Can you post a snippet of code in your Click handler that
updates the status bar text ?.
That will help us track down the cause of the issue

Regards,
Aravind C
"Ada" <an*******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
> i have a little bit of issue getting the status bar to work properly.
> this is what happens now.
>> when the program loaded, the status is "READY..." > the code is inside the FORM LOAD.
>> i also added the same code in another CLICK METHOD.

> everytime i click, the status got updated but the old "READY..."

got moved up one line above.
> so, if i click 10 times, i got a stack of 10 rows of status bar.
>> the question is....... > how do i destroy the old status bar and update the new info and

leaving it at the same position? >>> thanks in advance,

> Ada
>>>>

Nov 15 '05 #4
Ada
hi AC

that's what i did previously before i posted the message on this board
i was thinking because the code, although it's the same, appear twice in different method, C# compiler would do all the clean up automatically

i tried your suggestion below
no go
code doesn't even compile
err msg
C:\Form1.cs(694): The type or namespace name 'panel1' could not be found (are you missing a using directive or an assembly reference?

i think what happened here is that although the object got instantiated on the LOAD FORM method but it got destroyed when it exited LOAD FORM
when i click on another method which contained the same code, it looks for the INSTANCE
in this case, of course, i think it's out of scope
this is the reason why i added all enchilada again
obvioulsy, something didn't go as plan

i was thinking may be there's a DISPOSE() method somewhere i can call before create the new instance in the new method
may be that can take care of the problem

anyhow, i'm all open for any advice. :-

--Ad


----- Aravind C wrote: ----

Hi Ada

From what I undestand, in your Click handler, you call th
snippet of code that you posted. Correct ?

Actually, you must call the code that creates and adds th
status bar to the form's control collection only once
prefeably in the designer generated InitializeComponent(
called in the Form's Constructor or in Form's Load event handler
Otherwise we would end up creating and adding multiple instances of th
status bar to the windows form - which explains the behavio
you're seeing with the status bars being stacked one on top of another

For updating the status bar's text, it may be enough to call
panel1.Text = "....some text ...."; in your Click handler

Regards
Aravind
"Ada" <an*******@discussions.microsoft.com> wrote in messag
news:BC**********************************@microsof t.com..
hi AC
below is the snippet note, this is the exact same code in MSDN
// // Create a StatusBar control // StatusBar statusBar1 = new StatusBar()
/
// StatusBarPanel panel1 = new StatusBarPanel()
// panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken

// // Initialize the text of the panel
// panel1.Text = "Ready..."
// // Set the AutoSize property to use all remaining space on th

StatusBar // panel1.AutoSize = StatusBarPanelAutoSize.Spring
/
// // Display panels in the StatusBar control
// statusBar1.ShowPanels = true
/
// statusBar1.Panels.Add(panel1)
/
/
// // Add the StatusBar to the form
// this.Controls.Add(statusBar1)> ----- Aravind C wrote: ---- Hi Ada
Typically, the StatusBar.Text or the StatusBarPanel.Text property (i usin panel
in the status bar) should take care of updating the status bar text
Can you post a snippet of code in your Click handler tha
updates the status bar text ?
That will help us track down the cause of the issu
Regards Aravind "Ada" <an*******@discussions.microsoft.com> wrote in messag news:CC**********************************@microsof t.com..
i have a little bit of issue getting the status bar to wor properly this is what happens now
when the program loaded, the status is "READY...

the code is inside the FORM LOAD
i also added the same code in another CLICK METHOD

everytime i click, the status got updated but the old "READY...

got move up one line above
so, if i click 10 times, i got a stack of 10 rows of status bar
the question is...... how do i destroy the old status bar and update the new info an

leaving i at the same position thanks in advance

Ada
>

Nov 15 '05 #5
Hi Ada,

Actually, you must make the statusbar and its panels as _instance fields_
of the Form so that the form can access them from any method.
The windows form designer should automatically do this for you once you
drag and drop a status bar from the toolbox into the form.

public class MyForm : System.Windows.Forms.Form
{
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;

private void InitializeComponent()
{

this.statusBar1.Location = new System.Drawing.Point(0, 328);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[]
{
this.statusBarPanel1});
this.statusBar1.ShowPanels = true;
this.statusBar1.Size = new System.Drawing.Size(672, 22);
this.statusBar1.TabIndex = 2;
this.statusBar1.Text = "statusBar1";
this.statusBarPanel1.BorderStyle =
System.Windows.Forms.StatusBarPanelBorderStyle.Rai sed;
this.statusBarPanel1.Text = "Ready....";
this.statusBarPanel1.ToolTipText = "Test";

// ....

}

// Update the status panel's text
private void button1_Click(object sender, System.EventArgs e)
{
this.statusBarPanel1.Text = "Button clicked...";
}
}
Regards,
Aravind C

"Ada" <an*******@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com...
hi AC,

that's what i did previously before i posted the message on this board.
i was thinking because the code, although it's the same, appear twice in different method, C# compiler would do all the clean up automatically.
i tried your suggestion below.
no go.
code doesn't even compile.
err msg:
C:\Form1.cs(694): The type or namespace name 'panel1' could not be found (are you missing a using directive or an assembly reference?)

i think what happened here is that although the object got instantiated on the LOAD FORM method but it got destroyed when it exited LOAD FORM. when i click on another method which contained the same code, it looks for the INSTANCE. in this case, of course, i think it's out of scope.
this is the reason why i added all enchilada again.
obvioulsy, something didn't go as plan.

i was thinking may be there's a DISPOSE() method somewhere i can call before create the new instance in the new method. may be that can take care of the problem.

anyhow, i'm all open for any advice. :-)
--Ada


----- Aravind C wrote: -----

Hi Ada,

From what I undestand, in your Click handler, you call the
snippet of code that you posted. Correct ?.

Actually, you must call the code that creates and adds the
status bar to the form's control collection only once -
prefeably in the designer generated InitializeComponent()
called in the Form's Constructor or in Form's Load event handler.
Otherwise we would end up creating and adding multiple instances of the status bar to the windows form - which explains the behavior
you're seeing with the status bars being stacked one on top of another.
For updating the status bar's text, it may be enough to call,
panel1.Text = "....some text ...."; in your Click handler.

Regards,
Aravind C
"Ada" <an*******@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
> hi AC,
>> below is the snippet. > note, this is the exact same code in MSDN.
>>> // // Create a StatusBar control.

> // StatusBar statusBar1 = new StatusBar();
> //
> // StatusBarPanel panel1 = new StatusBarPanel();
>> // panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;

> // // Initialize the text of the panel.
> // panel1.Text = "Ready...";
> // // Set the AutoSize property to use all remaining space on the

StatusBar.
> // panel1.AutoSize = StatusBarPanelAutoSize.Spring;
> //
> // // Display panels in the StatusBar control.
> // statusBar1.ShowPanels = true;
> //
> // statusBar1.Panels.Add(panel1);
> //
> //
> // // Add the StatusBar to the form.
> // this.Controls.Add(statusBar1);
>>>>> ----- Aravind C wrote: -----
>> Hi Ada,
>> Typically, the StatusBar.Text or the StatusBarPanel.Text
property (if using
> panels
> in the status bar) should take care of updating the status bar text. > Can you post a snippet of code in your Click handler that
> updates the status bar text ?.
> That will help us track down the cause of the issue
>> Regards,

> Aravind C
>>> "Ada" <an*******@discussions.microsoft.com> wrote in message

> news:CC**********************************@microsof t.com...
>> i have a little bit of issue getting the status bar to work

properly. >> this is what happens now.
>>> when the program loaded, the status is "READY..."
>> the code is inside the FORM LOAD.
>>> i also added the same code in another CLICK METHOD.
>> everytime i click, the status got updated but the old "READY..."

got moved
> up one line above.
>> so, if i click 10 times, i got a stack of 10 rows of status bar.
>>> the question is.......
>> how do i destroy the old status bar and update the new info and

leaving it
> at the same position?
>>>> thanks in advance,
>> Ada
>>>>>

Nov 15 '05 #6
Ada
hi AC

i think your suggestion might work
this is what i have in mind also

if i make it GLOBAL (as you suggested), then i don't have to recreate the object everytime

i will give this code a try after i woke up
it is about 4 a.m. my time zone now
betta catch some zzzzzzzzzzz

thanks for all the help
Ad


----- Aravind C wrote: ----

Hi Ada

Actually, you must make the statusbar and its panels as _instance fields
of the Form so that the form can access them from any method
The windows form designer should automatically do this for you once yo
drag and drop a status bar from the toolbox into the form

public class MyForm : System.Windows.Forms.For

private System.Windows.Forms.StatusBar statusBar1
private System.Windows.Forms.StatusBarPanel statusBarPanel1

private void InitializeComponent(
this.statusBar1.Location = new System.Drawing.Point(0, 328)
this.statusBar1.Name = "statusBar1"
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[

this.statusBarPanel1})
this.statusBar1.ShowPanels = true
this.statusBar1.Size = new System.Drawing.Size(672, 22)
this.statusBar1.TabIndex = 2
this.statusBar1.Text = "statusBar1"
this.statusBarPanel1.BorderStyle
System.Windows.Forms.StatusBarPanelBorderStyle.Rai sed
this.statusBarPanel1.Text = "Ready...."
this.statusBarPanel1.ToolTipText = "Test"

// ...

// Update the status panel's tex
private void button1_Click(object sender, System.EventArgs e

this.statusBarPanel1.Text = "Button clicked..."


Regards
Aravind

"Ada" <an*******@discussions.microsoft.com> wrote in messag
news:A3**********************************@microsof t.com..
hi AC
that's what i did previously before i posted the message on this board i was thinking because the code, although it's the same, appear twice i

different method, C# compiler would do all the clean up automatically
i tried your suggestion below

no go
code doesn't even compile
err msg
C:\Form1.cs(694): The type or namespace name 'panel1' could not be foun

(are you missing a using directive or an assembly reference?
i think what happened here is that although the object got instantiated o
the LOAD FORM method but it got destroyed when it exited LOAD FORM when i click on another method which contained the same code, it looks fo the INSTANCE in this case, of course, i think it's out of scope
this is the reason why i added all enchilada again
obvioulsy, something didn't go as plan
i was thinking may be there's a DISPOSE() method somewhere i can cal before create the new instance in the new method
may be that can take care of the problem
anyhow, i'm all open for any advice. :-
--Ad
>>> ----- Aravind C wrote: ---- Hi Ada
From what I undestand, in your Click handler, you call th

snippet of code that you posted. Correct ?
Actually, you must call the code that creates and adds th

status bar to the form's control collection only once
prefeably in the designer generated InitializeComponent(
called in the Form's Constructor or in Form's Load event handler
Otherwise we would end up creating and adding multiple instances o

th status bar to the windows form - which explains the behavio
you're seeing with the status bars being stacked one on top o another For updating the status bar's text, it may be enough to call

panel1.Text = "....some text ...."; in your Click handler
Regards

Aravind "Ada" <an*******@discussions.microsoft.com> wrote in message news:BC**********************************@microsof t.com...
hi AC,
below is the snippet.

note, this is the exact same code in MSDN.
// // Create a StatusBar control.

// StatusBar statusBar1 = new StatusBar();
//
// StatusBarPanel panel1 = new StatusBarPanel();
// panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;

// // Initialize the text of the panel.
// panel1.Text = "Ready...";
// // Set the AutoSize property to use all remaining space on the

StatusBar.
// panel1.AutoSize = StatusBarPanelAutoSize.Spring;
//
// // Display panels in the StatusBar control.
// statusBar1.ShowPanels = true;
//
// statusBar1.Panels.Add(panel1);
//
//
// // Add the StatusBar to the form.
// this.Controls.Add(statusBar1);
>> ----- Aravind C wrote: -----
Hi Ada,
Typically, the StatusBar.Text or the StatusBarPanel.Text
property (if using
panels
in the status bar) should take care of updating the status bar

text. Can you post a snippet of code in your Click handler that
updates the status bar text ?.
That will help us track down the cause of the issue
Regards,

Aravind C
"Ada" <an*******@discussions.microsoft.com> wrote in message

news:CC**********************************@microsof t.com...
i have a little bit of issue getting the status bar to work

properly. this is what happens now.
when the program loaded, the status is "READY..."
the code is inside the FORM LOAD.
i also added the same code in another CLICK METHOD.
everytime i click, the status got updated but the old "READY..."

got moved
up one line above.
so, if i click 10 times, i got a stack of 10 rows of status bar.
the question is.......
how do i destroy the old status bar and update the new info and

leaving it
at the same position?
> thanks in advance,
Ada
>>

Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: mark4asp | last post by:
Why won't the window.status message change ? IE ver. 6.0.2800.1106 displays the tooltip OK. <td> <A HREF="editAuthor.asp?item=4" title="Edit author details"...
2
by: Charles Mendell | last post by:
1. When I go to http://www.w3schools.com/js/default.asp and choose: 2. JS HTML DOM and then choose: 3. the Window object and then choose: 4. Write some text in the windows status bar ( a link)...
19
by: Frances | last post by:
Firefox is not respecting window.status, examples in this pg http://www.csua.berkeley.edu/~jgwang/jsform02.htm are ignored by Firefox.. why is this.. is there a solution.. thank you.. Frances
3
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?...
4
by: Mark | last post by:
Hey folks, I'm looking at making the following query more efficient potentially using the ranking functions and I'd like some advice from the gurus. The purpose of the following is to have a...
3
by: bharathreddy | last post by:
This article will explain you how to find the status of the fax operation. (Using FAXCOM.dll). Author: Bharath Reddy VasiReddy Reference to the FAXCOM.DLL Reference to import FAXCOM...
0
by: Edwin.Madari | last post by:
updated creature running in its own thread will get you started. try it foryourself, change sleep times per your need. import os, sys, threading, time class Creature: def __init__(self,...
9
by: tshad | last post by:
I have a Windows App that is doing some work and then writing a "Now Processing..." line to the status line of the window as well as the Textbox on the form. But the problem is that the work is...
0
by: tvnaidu | last post by:
I wrote a status page HTML code, here I have 8 port status, it prints first 7 and last status it won't print, from there onwards it won't print footer also, if I make 10 instead 8, then it prints...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.