473,624 Members | 2,543 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make Label Counter work better?

I have a for each loop, that currently runs through an array of 11,000+
items. I exerpted the code part below that I have a question on. I thought
this code would update the form label and increment it by one each time the
code passed to the next element in the array. Maybe it just goes to fast,
but it goes from zero (default) to thte final number in what appears to be
one motion.

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
2 1785
Try refreshing the control.

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

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:ep******** ************@co mcast.com...
I have a for each loop, that currently runs through an array of 11,000+
items. I exerpted the code part below that I have a question on. I thought
this code would update the form label and increment it by one each time the code passed to the next element in the array. Maybe it just goes to fast,
but it goes from zero (default) to thte final number in what appears to be
one motion.

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
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. So
when I add your code to my class I can not access the labelRestrictSi tes
because it 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());
}
}

*************** *************** *************** *

"TomB" <sh*****@hotmai lXXX.com> wrote in message
news:uj******** *****@TK2MSFTNG P11.phx.gbl...
Try refreshing the control.

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

"Yogi_Bear_ 79" <IT*****@spamfr ee.com> wrote in message
news:ep******** ************@co mcast.com...
I have a for each loop, that currently runs through an array of 11,000+
items. I exerpted the code part below that I have a question on. I thought this code would update the form label and increment it by one each time

the
code passed to the next element in the array. Maybe it just goes to fast, but it goes from zero (default) to thte final number in what appears to be one motion.

private void AddRestrictedSi tes()

{

foreach(string x in strResSitesList )

{

MainForm frm = (MainForm)MainF orm.ActiveForm;

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

}

}


Nov 16 '05 #3

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

Similar topics

1
2109
by: Ken Fine | last post by:
I have a menu system that has nodes that can be opened or closed. In an effort to make my code more manageable, I programmed a little widget tonight that keeps track of the open/active item and automatically builds querystrings for my redirect URLS. The code for this follows. It defines an ASP Dictionary object, and key/value pairs for each, and builds appropriate querystrings based on comparison with a status variable. The way it works...
5
6515
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with the object references. However, I just realized that indices may only be referenced by strings.
18
23559
by: Tinus | last post by:
Hello, I want to do the following: I have 10 labels on my form, called Label0 to Label9. Now I want to change the Text property of all the labels at once, e.g.: for (int i = 0; i < 10; i++) { Label(i).Text = "Hello, this is label: "+i.ToString();
3
21090
by: kaiser | last post by:
Hello, Am new to C# and am playing around trying to get a while loop to display a int on a windows console using label. private void btnGo_Click(object sender, System.EventArgs e) { int Counter = 0; while ( Counter < 10 ) { lblMain.Text =Counter.ToString(); System.Threading.Thread.Sleep(5000);
16
11537
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images, image N, the panel N becomes visible and all the other invisible.
52
4087
by: mavic | last post by:
hi to everybody,i need help for my project....how to make a program that accept any integer and convert it binary,octal and hexadecimal.pls help me...thanks
6
4863
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
10
2170
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All I am doing is quering the db for all the headers for a certain group and then going through them to find all the parts of each post. I only want ones that are complete. Meaning all segments for that one file posted are there. using System;
71
10719
by: active | last post by:
In the main program I check to see if a certain form has been disposed. Does it make sense in that form's FormClosed event to do: Me.Dispose to make sure it is disposed the next time I check. Or is that automatic? Thanks
0
8249
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...
0
8179
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8493
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...
1
6112
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
4084
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4187
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2613
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
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
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.