473,625 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help With Label Refresh

Self Taught here so please bear with me.

I have the labelRestrictSi tes as private on the MainForm.cs. I then access
the labelRestrictSi tes.Text thru the public string LabelRestrictSi tes from
another class. So
when I add labelRestrictSi tes.refresh code to my class I get an error
because the labelRestrictSi tes
is private. How would I refresh?

*************** *************** **********
mainform.cs
private System.Windows. Forms.Label labelRestrictSi tes;

public string LabelRestrictSi tes

{

get { return labelRestrictSi tes.Text; }

set { labelRestrictSi tes.Text = value; }

}//end property

*************** *************** **************
RestircedSites. cs
private void AddRestrictedSi tes()
{
foreach(string x in strResSitesList )
{
MainForm frm = (MainForm)MainF orm.ActiveForm;

frm.LabelRestri ctSites = ((iTotal += 1).ToString());
}
}

Nov 16 '05 #1
4 8235
Yogi_Bear_79,

Can you show the call to refresh? It's not in the sample code that you
posted. Also, what is the error that you are getting? It sounds like a
compile time error, but without seeing the code or the error, it's hard to
provide any insight.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:ad******** ************@co mcast.com...
Self Taught here so please bear with me.

I have the labelRestrictSi tes as private on the MainForm.cs. I then access
the labelRestrictSi tes.Text thru the public string LabelRestrictSi tes from
another class. So
when I add labelRestrictSi tes.refresh code to my class I get an error
because the labelRestrictSi tes
is private. How would I refresh?

*************** *************** **********
mainform.cs
private System.Windows. Forms.Label labelRestrictSi tes;

public string LabelRestrictSi tes

{

get { return labelRestrictSi tes.Text; }

set { labelRestrictSi tes.Text = value; }

}//end property

*************** *************** **************
RestircedSites. cs
private void AddRestrictedSi tes()
{
foreach(string x in strResSitesList )
{
MainForm frm = (MainForm)MainF orm.ActiveForm;

frm.LabelRestri ctSites = ((iTotal += 1).ToString());
}
}

Nov 16 '05 #2
I added the line of code in line below. The compile time error is:

MainForm.labeRe strictedSites is inaccessible due to it's protection level

Which I think I understand. That's why I have a public string to access the
text of this label. But I don't know/understand how to access the refresh
feature now
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Yogi_Bear_79,

Can you show the call to refresh? It's not in the sample code that you posted. Also, what is the error that you are getting? It sounds like a
compile time error, but without seeing the code or the error, it's hard to
provide any insight.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:ad******** ************@co mcast.com...
Self Taught here so please bear with me.

I have the labelRestrictSi tes as private on the MainForm.cs. I then access the labelRestrictSi tes.Text thru the public string LabelRestrictSi tes from another class. So
when I add labelRestrictSi tes.refresh code to my class I get an error
because the labelRestrictSi tes
is private. How would I refresh?

*************** *************** **********
mainform.cs
private System.Windows. Forms.Label labelRestrictSi tes;

public string LabelRestrictSi tes

{

get { return labelRestrictSi tes.Text; }

set { labelRestrictSi tes.Text = value; }

}//end property

*************** *************** **************
RestircedSites. cs
private void AddRestrictedSi tes()
{
foreach(string x in strResSitesList )
{
MainForm frm = (MainForm)MainF orm.ActiveForm;

frm.LabelRestri ctSites = ((iTotal += 1).ToString());
frm.LabelRest rictSites.Refre sh();
}
}


Nov 16 '05 #3
Yogi_Bear_79,

So if I understand correctly, you want to invoke a refresh from outside
of the class that is hosting the control. In this case, you would have to
expose either the control itself, and call Refresh on that, or create a
method that will call Refresh on the control for you.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:s9******** ************@co mcast.com...
I added the line of code in line below. The compile time error is:

MainForm.labeRe strictedSites is inaccessible due to it's protection level

Which I think I understand. That's why I have a public string to access
the
text of this label. But I don't know/understand how to access the refresh
feature now
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Yogi_Bear_79,

Can you show the call to refresh? It's not in the sample code that

you
posted. Also, what is the error that you are getting? It sounds like a
compile time error, but without seeing the code or the error, it's hard
to
provide any insight.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:ad******** ************@co mcast.com...
> Self Taught here so please bear with me.
>
> I have the labelRestrictSi tes as private on the MainForm.cs. I then access > the labelRestrictSi tes.Text thru the public string LabelRestrictSi tes from > another class. So
> when I add labelRestrictSi tes.refresh code to my class I get an error
> because the labelRestrictSi tes
> is private. How would I refresh?
>
> *************** *************** **********
> mainform.cs
> private System.Windows. Forms.Label labelRestrictSi tes;
>
> public string LabelRestrictSi tes
>
> {
>
> get { return labelRestrictSi tes.Text; }
>
> set { labelRestrictSi tes.Text = value; }
>
> }//end property
>
> *************** *************** **************
> RestircedSites. cs
> private void AddRestrictedSi tes()
> {
> foreach(string x in strResSitesList )
> {
> MainForm frm = (MainForm)MainF orm.ActiveForm;
>
> frm.LabelRestri ctSites = ((iTotal += 1).ToString());
frm.LabelRes trictSites.Refr esh();
> }
> }
>
>
>



Nov 16 '05 #4
Nicholas,

Yes this started because as my code updates the labels text value, it
doesn't appear to go up on the form. Meaning it goes from default of Zero,
to the end number in what appears to be an instant. The thinking was if we
invoked a refresh after every loop we could see the number grow. If I
understand you, I can create a method on the form class itself, then call
that method from my other class.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:ey******** ******@TK2MSFTN GP09.phx.gbl...
Yogi_Bear_79,

So if I understand correctly, you want to invoke a refresh from outside of the class that is hosting the control. In this case, you would have to
expose either the control itself, and call Refresh on that, or create a
method that will call Refresh on the control for you.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:s9******** ************@co mcast.com...
I added the line of code in line below. The compile time error is:

MainForm.labeRe strictedSites is inaccessible due to it's protection level
Which I think I understand. That's why I have a public string to access
the
text of this label. But I don't know/understand how to access the refresh feature now
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in
message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Yogi_Bear_79,

Can you show the call to refresh? It's not in the sample code that

you
posted. Also, what is the error that you are getting? It sounds like a compile time error, but without seeing the code or the error, it's hard
to
provide any insight.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:ad******** ************@co mcast.com...
> Self Taught here so please bear with me.
>
> I have the labelRestrictSi tes as private on the MainForm.cs. I then

access
> the labelRestrictSi tes.Text thru the public string LabelRestrictSi tes

from
> another class. So
> when I add labelRestrictSi tes.refresh code to my class I get an error
> because the labelRestrictSi tes
> is private. How would I refresh?
>
> *************** *************** **********
> mainform.cs
> private System.Windows. Forms.Label labelRestrictSi tes;
>
> public string LabelRestrictSi tes
>
> {
>
> get { return labelRestrictSi tes.Text; }
>
> set { labelRestrictSi tes.Text = value; }
>
> }//end property
>
> *************** *************** **************
> RestircedSites. cs
> private void AddRestrictedSi tes()
> {
> foreach(string x in strResSitesList )
> {
> MainForm frm = (MainForm)MainF orm.ActiveForm;
>
> frm.LabelRestri ctSites = ((iTotal += 1).ToString());
frm.LabelRes trictSites.Refr esh();
> }
> }
>
>
>



Nov 16 '05 #5

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

Similar topics

4
326
by: Ed Willis | last post by:
If I am processing through a loop in my code and I want to update a row count on the window, how can I make the window refresh and show the label etc. updating? Thanks.
2
399
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page that gets redirected to, I've swapped in a simple page for testing that reads the session variables and displays their values.
3
6276
by: KenMacksey | last post by:
Hi I am running VB6 on a pentium 4 and Win XP pro. I wrote a small program to copy files to a memory card or mp3 player etc in a specific order or a random order instead of the windows default alphabetical order. Because the files take about 1 second to be copied, if there are 150 files, it takes about 150 seconds to copy them all. During this time, it appears as if nothing is happening, so I use a label that is constantly updated and...
13
7731
by: AKHTAR ALI | last post by:
Dear Sir, i am reading a text file line by line from vb and insert in oracle table through pl/sql procedure. in text file record is 70000, in my code i make a loop to read data in loop and insert in a oracle through pl/sql procedure. in a loop i make a counter in the starting of loop set counter value=1 loop is run 70000 time becos data in text file is 70000. so i am display a label in the form the counter value display in label and...
4
1659
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I have a couple of questions, these are problems that I have experienced with IE 6 1. I have a label on a form, and sometimes when the form refreshes the label doesn't appear on the screen, however when I hide the form and then reshow it the label appears. So I was wondering how to refresh the form so I don't have to hide and show to see the label. 2. I have another form that has a drop down list, button and a label and it scrolls....
1
1123
by: zombie212 | last post by:
I have devoloped a page in asp.net with datagrid with code behind in VB, to show the result of SP_ who2 ( SQL Server System stored proc). Now I have also added a refresh button to update the page, When I refresh the page users keep incrementing which in turn get added to the database, Please help me in showing the correct users not the repeated ones. thanks!!!!
3
4008
by: Mike | last post by:
Is there a way to determine if a page was refreshed? I have a function that is called when the page loads, but when the user refreshes the page it calls the function again. Is there a way to call the function only when the page initially loads? I don't want it to load when the user clicks the refresh button.
3
1807
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hi all, i betcha here's a question never asked before ;) i have a simple web form with a gridview and a button. the button doesn't do anything but a postback. i load up the gridview from the database, hit the button, then hit the refresh button and here's where my question occurs. I get a message saying that "it needs to resubmit/resend the data?" what is happening here and how do I resolve this undesired message?
3
1271
by: c0elh0 | last post by:
Hello all, I'm new to this forum and to c# too, so there are some technical questions I'm not familiar to in c#. I'm building a program based on a FORM controled by another pc (like a server) with several tabs. In each tab I have different panels in wich I wan't to display some images, button, etc. The problem is, when i run the project, the components I added aren't displayed. This is probably a refresh/paint problem because when I...
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8354
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2621
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 we have to send another system
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.