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.com> wrote in
message news:ey**************@TK2MSFTNGP09.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.com
"Yogi_Bear_79" <IT*****@spamfree.com> wrote in message
news:s9********************@comcast.com...I added the line of code in line below. The compile time error is:
MainForm.labeRestrictedSites 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.com> wrote
in
message news:%2****************@TK2MSFTNGP09.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.com
"Yogi_Bear_79" <IT*****@spamfree.com> wrote in message
news:ad********************@comcast.com...
> Self Taught here so please bear with me.
>
> I have the labelRestrictSites as private on the MainForm.cs. I then
access > the labelRestrictSites.Text thru the public string LabelRestrictSites
from > another class. So
> when I add labelRestrictSites.refresh code to my class I get an error
> because the labelRestrictSites
> is private. How would I refresh?
>
> ****************************************
> mainform.cs
> private System.Windows.Forms.Label labelRestrictSites;
>
> public string LabelRestrictSites
>
> {
>
> get { return labelRestrictSites.Text; }
>
> set { labelRestrictSites.Text = value; }
>
> }//end property
>
> ********************************************
> RestircedSites.cs
> private void AddRestrictedSites()
> {
> foreach(string x in strResSitesList)
> {
> MainForm frm = (MainForm)MainForm.ActiveForm;
>
> frm.LabelRestrictSites = ((iTotal += 1).ToString());
frm.LabelRestrictSites.Refresh();
> }
> }
>
>
>