![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
any C# programmers on here?
Please disregard the two For Statement they're wrong and outputting multiple ListID entries of the same thing. That's the problem and I need help fixing it. The MakeReq function has nothing to do with my problem its just holding values like an array does.
Code:
if (listId.Items.Count != 0 && listCell.Items.Count != 0) { for (int a = 0; a < listId.Items.Count; a++) { for (int b = 0; b < listCell.Items.Count; b++) { lblID.Text = listId.Items[a].ToString(); MakeReq(txtWebUpdate.Text + listId.Items[a].ToString() + "&ire=1", listCell.Items[b].ToString()); //System.Threading.Thread.Sleep(5); } } } store.domain.com 101 &ire=1 sec01 store.domain.com 102 &ire=1 sec02 store.domain.com 103 &ire=1 sec03 store.domain.com 104 &ire=1 sec04 store.domain.com 105 &ire=1 sec01 store.domain.com 106 &ire=1 sec02 <- ^ notice how listCell started over for the last two entries. that's because listCell only has 4 entry so it continuously loops applying secIDs until all ListIDs have been processed. So there maybe 500 ListID and only 20 listCell secIDs, which means listCell will just loop within itself applying the same secIDs from the top of its list down, again and again. it's a simple concept, but you won't believe how many C# programmers are clueless as to what i'm trying to accomplish. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2002
Location: Las Vegas
Posts: 6,504
|
here you go, just remove/replace the temporary stuff w/ your stuff
Code:
List<string> listId = new List<string>(); List<string> listCell = new List<string>(); listId.Add("id1"); listId.Add("id2"); listId.Add("id3"); listId.Add("id4"); listId.Add("id5"); listId.Add("id6"); listCell.Add("cell1"); listCell.Add("cell2"); listCell.Add("cell3"); listCell.Add("cell4"); int listCellCounter = 0; for (int x = 0; x < listId.Count; x++) { Debug.WriteLine("something " + listId[x] + " " + listCell[listCellCounter]); if (listCellCounter == listCell.Count() -1) { listCellCounter = 0; } else { listCellCounter += 1; } } something id1 cell1 something id2 cell2 something id3 cell3 something id4 cell4 something id5 cell1 something id6 cell2
__________________
112.020.756 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Supermodel
Industry Role:
Join Date: Nov 2004
Location: Sodoma & Gomorra
Posts: 22,890
|
I failed at c++ at university
![]()
__________________
SMC Revenue - Best Tgirl websites of the world now VR ![]() Non exclusive BIG Tranny/shemale Package for sale, full 2257 - hit me up skype: nikkimontero ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Let slip the dogs of war.
Industry Role:
Join Date: Jan 2003
Location: Bermuda
Posts: 17,263
|
Tical beat me to it.
__________________
. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
tical THANK YOU! ... been at this for over a week.
another question is System.Threading.Thread.Sleep() the best method for pausing/sleeping? I used it earlier where trying to debug and it felt like it was hang the app. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: Feb 2002
Location: Las Vegas
Posts: 6,504
|
Quote:
If you're calling something like: void dowork { // some code // loop w/ sleep // other code } Then "other code" won't execute until the loop w/ sleep is done, so if there are a ton of listids then it might seem like it's lagging. Plus your form is going to get "stuck" during each sleep iteration. If you want to have it run in the background without having that error. Then do something like this: void listidloop { // your loop code w/ thread.sleep, etc. } and in the function you're calling it from (form or other class): Thread t = new Thread(listidloop); t.Start(); That way it operates in a separate thread and doesn't lock up your form. The problem here is if the listidloop function is trying to update the form form (ie, textbox1.text = "", etc) then you're going to get a cross thread error and will need to use delegates/invoking for this.
__________________
112.020.756 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Let slip the dogs of war.
Industry Role:
Join Date: Jan 2003
Location: Bermuda
Posts: 17,263
|
Quote:
![]()
__________________
. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
am i doing this correctly, trying replace the pre-loaded entries from your example with my actual listboxs for loading/processing
Code:
List<string> listId = new List<string>(); foreach(var item in this.listId.Items) { listId.Add(item.ToString()); } List<string> listCell = new List<string>(); foreach(var item in this.listCell.Items) { listCell.Add(item.ToString()); } int listCellCounter = 0; for (int x = 0; x < listId.Count; x++) { Debug.WriteLine("something " + listId[x] + " " + listCell[listCellCounter]); if (listCellCounter == listCell.Count() -1) { listCellCounter = 0; } else { listCellCounter += 1; } } |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Join Date: Feb 2002
Location: Las Vegas
Posts: 6,504
|
Quote:
Something like this, my sytax may be off a bit... but it should be clear! Hope that helps Code:
int listCellCounter = 0; for (int x = 0; x < listId.Items.Count; x++) { Debug.WriteLine("something " + listId.Item[x] + " " + listCell.Item[listCellCounter]); if (listCellCounter == listCell.Items.Count() -1) { listCellCounter = 0; } else { listCellCounter += 1; } }
__________________
112.020.756 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Dec 2002
Posts: 20,892
|
Remember when you copied my webcam page and left my counter code on it? That was some funny shit.
Still got that BMW you did all the custom work to? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Industry Role:
Join Date: Aug 2001
Posts: 63,151
|
Asm programmer for Z80 processors here
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
Spunky! LOL that was back during the ynot irc chat. hey man what's up, how have you been? Still got the BMW, just hit 66k miles on it. I stopped customizing it after I won first place at NOPI Nationals, that's all I wanted.
|
![]() |
![]() ![]() ![]() ![]() ![]() |