473,566 Members | 3,202 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 8231
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
6274
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...
13
7723
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...
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...
1
1122
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...
3
4005
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
1803
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...
3
1268
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...
0
7588
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8115
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7959
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...
0
5216
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...
0
3648
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2093
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
1205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
930
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...

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.