-2
votes
2answers
42 views

Putting a program in a loop

Just finishing up a program that some very helpful people on this site have advised me on. The program grabs a user name from a list box, uses webBrowser control to enter the proper URL and then ...
-3
votes
0answers
92 views

Is there another way I can reduce my code and improve its readability? [closed]

I have a block of C# code here that store data to an arraylist from the database, and compare each with the values from the gridview. I am thinking if there's way to reduce the line of code and ...
0
votes
2answers
30 views

Loop through nodes of tree view from current selected

I have a tree view that has been built fine with no issues. Is their a way to start looping through the nodes at the current selected node instead of looping through all of them? TreeNodeCollection ...
0
votes
7answers
6k views

Current index of foreach loop

Is there anyway to know the current run of a foreach without have to: Int32 i; foreach i++; or is that the best option i got? Also, how can i know the maximum number of items on that loop? What ...
-1
votes
3answers
51 views

multithreading re-entrancy issue

I'm trying to spawn different threads for some processing. I use the for loop index for some logic inside each thread. How can I get the different threads to print 1,2,3,4, 5 in the code below? Each ...
2
votes
1answer
69 views

Why can't the result of a modulo operation be used in an if statement directly?

I'm doing a challenge from a book and it's asking me to create a loop that counts down from 20 to 0 and has me print a message for each number. However, it's asking me to print out a special message ...
1
vote
4answers
99 views

Generating a list of page numbers for a web page

I am trying to add paging to a website by showing 10 numbers at the top of each page. I wrote this code to generate the 10 numbers that correspond to each page @for (int i = (Math.Ceiling( page / 10 ...
-5
votes
0answers
72 views

c# loop through list held within class [closed]

I have a class named User that contains a List ControlNumber. public class User { private string _name; public string UserName { get; set; } public List<int?> ControlNumber { get; ...
5
votes
5answers
70 views

Looping over XAML defined labels

I have a WPF application with many labels. <Label x:Name="label1" /> <Label x:Name="label2" /> <Label x:Name="label3" /> .... I dont want give every label a value one by one like: ...
1
vote
1answer
35 views

c# drawing objects at once instead of using a loop

Hello i am trying to draw about 1000 images and between 10 to 100 rectangels and elipses. But i need all of them to show up on screen only when they done loading(not in a loading screen but in a game ...
-11
votes
5answers
121 views

String Array Loop [closed]

I have a String Array that has 5000 Indexes. now I want to loop through them but only 1300 indexes at time until the end of string array how can I do this? this is what I have so far String [] ...
0
votes
4answers
78 views

Cannot update Database C# in loop

I have a Visual C# application on Visual Studio 2010. On a form I have 2 listBoxes. The first one contains IDs and the second one numbers, all of which are saved on a database I've created. I also ...
7
votes
9answers
13k views

Iterating through the Alphabet - C# a-caz

Hi i have question about iterate throught the Alphabet. I would like to have a loop that begins with "a" and ends with "z". After that the loop begins "aa" and count to "az". after that begins with ...
1
vote
3answers
111 views

c#: Checking if datarow exists in a different datatable with dynamic columns

I want to check if a DataRow from one DataTable exists in a different DataTable. I have two DataTables. There's going to be some DataRows that are the same and exist in both. This would be so easy if ...
0
votes
4answers
80 views

How to perform a double loop jump?

I have a code like: while(condition) { foreach(string s in list) { switch(j) { case 1: //do something continue;//can I break out of foreach ...

1 2 3 4 5 54
15 30 50 per page