473,465 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't display label text

Hi, I have the following method where I need to display which database is
being processed, however, the label lblDatabase dosn't seem to work until the
end.

private void AddPathAndCallCompactDB(string dbFolder, string systemDB,
string UserID, string Pwd, string dbFileName)
{
FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
this.lblDatabase.Text = dbFileInfo.Name;
if (dbFileInfo.Exists)
{
CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
progressBar.Value++;
}
else
//Cannot find database file
{
MessageBox.Show("Cannot find the database " + dbFileInfo.FullName + "\n" +
"\n" +
"Check the database name (and path, if specified) to make sure it exists." +
"\n" + "\n" +
"The other databases will be compacted.",
messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
}
}
Nov 16 '05 #1
7 6728
Things to check:

1. Is the label property visible set to true?

2. Are the font color and back colour the same?

3. If you change it to display a message box is there actually a name in the
property?

FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

4. Are the label width and height greater than zero?

Hope that helps.

Dan.

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
Hi, I have the following method where I need to display which database is
being processed, however, the label lblDatabase dosn't seem to work until
the
end.

private void AddPathAndCallCompactDB(string dbFolder, string systemDB,
string UserID, string Pwd, string dbFileName)
{
FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
this.lblDatabase.Text = dbFileInfo.Name;
if (dbFileInfo.Exists)
{
CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
progressBar.Value++;
}
else
//Cannot find database file
{
MessageBox.Show("Cannot find the database " + dbFileInfo.FullName + "\n" +
"\n" +
"Check the database name (and path, if specified) to make sure it exists."
+
"\n" + "\n" +
"The other databases will be compacted.",
messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
}
}

Nov 16 '05 #2
Hi Dan thanks for the help. I tried

//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which works ok, I then tried

this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which also works. However,

this.lblDatabase.Text = dbFileInfo.Name;
//MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

does not work. This is driving me crazy!! Any other thoughts anybody?
"Dan Bass" wrote:
Things to check:

1. Is the label property visible set to true?

2. Are the font color and back colour the same?

3. If you change it to display a message box is there actually a name in the
property?

FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

4. Are the label width and height greater than zero?

Hope that helps.

Dan.

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
Hi, I have the following method where I need to display which database is
being processed, however, the label lblDatabase dosn't seem to work until
the
end.

private void AddPathAndCallCompactDB(string dbFolder, string systemDB,
string UserID, string Pwd, string dbFileName)
{
FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
this.lblDatabase.Text = dbFileInfo.Name;
if (dbFileInfo.Exists)
{
CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
progressBar.Value++;
}
else
//Cannot find database file
{
MessageBox.Show("Cannot find the database " + dbFileInfo.FullName + "\n" +
"\n" +
"Check the database name (and path, if specified) to make sure it exists."
+
"\n" + "\n" +
"The other databases will be compacted.",
messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
}
}


Nov 16 '05 #3
what about this:

this.lblDatabase.Text = "Hello World";
finally, in the designer, if the label is blank make sure you can put text
in it.

Thanks.

Dan

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Hi Dan thanks for the help. I tried

//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which works ok, I then tried

this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which also works. However,

this.lblDatabase.Text = dbFileInfo.Name;
//MessageBox.Show ( "The value of dbFileInfo.Name is: " +
dbFileInfo.Name );

does not work. This is driving me crazy!! Any other thoughts anybody?
"Dan Bass" wrote:
Things to check:

1. Is the label property visible set to true?

2. Are the font color and back colour the same?

3. If you change it to display a message box is there actually a name in
the
property?

FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " +
dbFileInfo.Name );

4. Are the label width and height greater than zero?

Hope that helps.

Dan.

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
> Hi, I have the following method where I need to display which database
> is
> being processed, however, the label lblDatabase dosn't seem to work
> until
> the
> end.
>
> private void AddPathAndCallCompactDB(string dbFolder, string systemDB,
> string UserID, string Pwd, string dbFileName)
> {
> FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
> this.lblDatabase.Text = dbFileInfo.Name;
> if (dbFileInfo.Exists)
> {
> CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
> progressBar.Value++;
> }
> else
> //Cannot find database file
> {
> MessageBox.Show("Cannot find the database " + dbFileInfo.FullName +
> "\n" +
> "\n" +
> "Check the database name (and path, if specified) to make sure it
> exists."
> +
> "\n" + "\n" +
> "The other databases will be compacted.",
> messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
> }
> }


Nov 16 '05 #4
this.lblDatabase.Text = "Hello World"; only works with the line

MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

I've also setup a new button on the form with

private void button1_Click(object sender, System.EventArgs e)
{
lblDatabase.Text = "Hello World";
}

which works OK. Does the
this.lblDatabase.Text = dbFileInfo.Name;
need an event to fire to display the value? This can't be correct!

"Dan Bass" wrote:
what about this:

this.lblDatabase.Text = "Hello World";
finally, in the designer, if the label is blank make sure you can put text
in it.

Thanks.

Dan

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Hi Dan thanks for the help. I tried

//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which works ok, I then tried

this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which also works. However,

this.lblDatabase.Text = dbFileInfo.Name;
//MessageBox.Show ( "The value of dbFileInfo.Name is: " +
dbFileInfo.Name );

does not work. This is driving me crazy!! Any other thoughts anybody?
"Dan Bass" wrote:
Things to check:

1. Is the label property visible set to true?

2. Are the font color and back colour the same?

3. If you change it to display a message box is there actually a name in
the
property?

FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " +
dbFileInfo.Name );

4. Are the label width and height greater than zero?

Hope that helps.

Dan.

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
> Hi, I have the following method where I need to display which database
> is
> being processed, however, the label lblDatabase dosn't seem to work
> until
> the
> end.
>
> private void AddPathAndCallCompactDB(string dbFolder, string systemDB,
> string UserID, string Pwd, string dbFileName)
> {
> FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
> this.lblDatabase.Text = dbFileInfo.Name;
> if (dbFileInfo.Exists)
> {
> CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
> progressBar.Value++;
> }
> else
> //Cannot find database file
> {
> MessageBox.Show("Cannot find the database " + dbFileInfo.FullName +
> "\n" +
> "\n" +
> "Check the database name (and path, if specified) to make sure it
> exists."
> +
> "\n" + "\n" +
> "The other databases will be compacted.",
> messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
> }
> }


Nov 16 '05 #5
Managed to solve this by using

lblDatabase.Text = dbFileInfo.Name;
lblDatabase.Refresh();

Thanks
"jez123456" wrote:
this.lblDatabase.Text = "Hello World"; only works with the line

MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

I've also setup a new button on the form with

private void button1_Click(object sender, System.EventArgs e)
{
lblDatabase.Text = "Hello World";
}

which works OK. Does the
this.lblDatabase.Text = dbFileInfo.Name;
need an event to fire to display the value? This can't be correct!

"Dan Bass" wrote:
what about this:

this.lblDatabase.Text = "Hello World";
finally, in the designer, if the label is blank make sure you can put text
in it.

Thanks.

Dan

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Hi Dan thanks for the help. I tried

//this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which works ok, I then tried

this.lblDatabase.Text = dbFileInfo.Name;
MessageBox.Show ( "The value of dbFileInfo.Name is: " + dbFileInfo.Name );

which also works. However,

this.lblDatabase.Text = dbFileInfo.Name;
//MessageBox.Show ( "The value of dbFileInfo.Name is: " +
dbFileInfo.Name );

does not work. This is driving me crazy!! Any other thoughts anybody?
"Dan Bass" wrote:

> Things to check:
>
> 1. Is the label property visible set to true?
>
> 2. Are the font color and back colour the same?
>
> 3. If you change it to display a message box is there actually a name in
> the
> property?
>
> FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
> //this.lblDatabase.Text = dbFileInfo.Name;
> MessageBox.Show ( "The value of dbFileInfo.Name is: " +
> dbFileInfo.Name );
>
> 4. Are the label width and height greater than zero?
>
> Hope that helps.
>
> Dan.
>
> "jez123456" <je*******@discussions.microsoft.com> wrote in message
> news:10**********************************@microsof t.com...
> > Hi, I have the following method where I need to display which database
> > is
> > being processed, however, the label lblDatabase dosn't seem to work
> > until
> > the
> > end.
> >
> > private void AddPathAndCallCompactDB(string dbFolder, string systemDB,
> > string UserID, string Pwd, string dbFileName)
> > {
> > FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
> > this.lblDatabase.Text = dbFileInfo.Name;
> > if (dbFileInfo.Exists)
> > {
> > CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
> > progressBar.Value++;
> > }
> > else
> > //Cannot find database file
> > {
> > MessageBox.Show("Cannot find the database " + dbFileInfo.FullName +
> > "\n" +
> > "\n" +
> > "Check the database name (and path, if specified) to make sure it
> > exists."
> > +
> > "\n" + "\n" +
> > "The other databases will be compacted.",
> > messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
> > }
> > }
>
>
>


Nov 16 '05 #6
Oh right, did you go off and do more operations after this?

Remember that redraws are not do instantly. If you want to a redraw then
call Refresh(). I generally don't call Refresh() on individual controls, but
rather the parent form.

glad you got it sorted!

"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
Managed to solve this by using

lblDatabase.Text = dbFileInfo.Name;
lblDatabase.Refresh();

Thanks
"jez123456" wrote:
this.lblDatabase.Text = "Hello World"; only works with the line

MessageBox.Show ( "The value of dbFileInfo.Name is: " +
dbFileInfo.Name );

I've also setup a new button on the form with

private void button1_Click(object sender, System.EventArgs e)
{
lblDatabase.Text = "Hello World";
}

which works OK. Does the
this.lblDatabase.Text = dbFileInfo.Name;
need an event to fire to display the value? This can't be correct!

"Dan Bass" wrote:
> what about this:
>
> this.lblDatabase.Text = "Hello World";
>
>
> finally, in the designer, if the label is blank make sure you can put
> text
> in it.
>
> Thanks.
>
> Dan
>
> "jez123456" <je*******@discussions.microsoft.com> wrote in message
> news:C7**********************************@microsof t.com...
> > Hi Dan thanks for the help. I tried
> >
> > //this.lblDatabase.Text = dbFileInfo.Name;
> > MessageBox.Show ( "The value of dbFileInfo.Name is: " +
> > dbFileInfo.Name );
> >
> > which works ok, I then tried
> >
> > this.lblDatabase.Text = dbFileInfo.Name;
> > MessageBox.Show ( "The value of dbFileInfo.Name is: " +
> > dbFileInfo.Name );
> >
> > which also works. However,
> >
> > this.lblDatabase.Text = dbFileInfo.Name;
> > //MessageBox.Show ( "The value of dbFileInfo.Name is: " +
> > dbFileInfo.Name );
> >
> > does not work. This is driving me crazy!! Any other thoughts anybody?
> >
> >
> > "Dan Bass" wrote:
> >
> >> Things to check:
> >>
> >> 1. Is the label property visible set to true?
> >>
> >> 2. Are the font color and back colour the same?
> >>
> >> 3. If you change it to display a message box is there actually a
> >> name in
> >> the
> >> property?
> >>
> >> FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
> >> //this.lblDatabase.Text = dbFileInfo.Name;
> >> MessageBox.Show ( "The value of dbFileInfo.Name is: " +
> >> dbFileInfo.Name );
> >>
> >> 4. Are the label width and height greater than zero?
> >>
> >> Hope that helps.
> >>
> >> Dan.
> >>
> >> "jez123456" <je*******@discussions.microsoft.com> wrote in message
> >> news:10**********************************@microsof t.com...
> >> > Hi, I have the following method where I need to display which
> >> > database
> >> > is
> >> > being processed, however, the label lblDatabase dosn't seem to
> >> > work
> >> > until
> >> > the
> >> > end.
> >> >
> >> > private void AddPathAndCallCompactDB(string dbFolder, string
> >> > systemDB,
> >> > string UserID, string Pwd, string dbFileName)
> >> > {
> >> > FileInfo dbFileInfo = new FileInfo(dbFolder + dbFileName);
> >> > this.lblDatabase.Text = dbFileInfo.Name;
> >> > if (dbFileInfo.Exists)
> >> > {
> >> > CompactDB(systemDB, UserID, Pwd, dbFileInfo.FullName);
> >> > progressBar.Value++;
> >> > }
> >> > else
> >> > //Cannot find database file
> >> > {
> >> > MessageBox.Show("Cannot find the database " + dbFileInfo.FullName
> >> > +
> >> > "\n" +
> >> > "\n" +
> >> > "Check the database name (and path, if specified) to make sure it
> >> > exists."
> >> > +
> >> > "\n" + "\n" +
> >> > "The other databases will be compacted.",
> >> > messageHeader,MessageBoxButtons.OK,MessageBoxIcon. Exclamation);
> >> > }
> >> > }
> >>
> >>
> >>
>
>
>

Nov 16 '05 #7
In article <56**********************************@microsoft.co m>,
jez123456 <je*******@discussions.microsoft.com> wrote:
Managed to solve this by using

lblDatabase.Text = dbFileInfo.Name;
lblDatabase.Refresh();


So you are doing more processing after this? If it is taking a while
then perhaps you should be doing the processing in a thread.
Nov 16 '05 #8

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

Similar topics

1
by: Agency | last post by:
I'm still working on the bpm counter. I need to have at least 2 displays that are not static. One would be a clock/running time and the other would should the current beat count. How would I...
1
by: Saper\(ek\) | last post by:
I need to encrypt some data in my program, so I've created 2 functions to encrypt and decrypt data. I've created a simple program to test it, and... it crashes. It wors ok on XP, but on win98 it...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
4
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
1
by: bruce628 | last post by:
I want to use SWT tab compnent and make it be multiline,but I fail.please see the class TabFolderExample. Can aneone help me? import java.awt.BorderLayout; import...
6
by: cmdolcet69 | last post by:
I need a way to get the .text property of a label however i dont want to display that property in the label box. I thought i could do somthing with the visible property however it will not show the...
1
by: COHENMARVIN | last post by:
I have a asp.net page that does something simple - when the user clicks on a radiobutton, a panel becomes visible beneath the radio button. There is some text below the radio button, and that is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.