Click here to Skip to main content
15,897,315 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL querying problem Pin
sravsk15-Dec-09 21:12
sravsk15-Dec-09 21:12 
AnswerRe: SQL querying problem Pin
Nicholas Butler6-Nov-09 2:00
sitebuilderNicholas Butler6-Nov-09 2:00 
AnswerRe: SQL querying problem Pin
Calla6-Nov-09 2:36
Calla6-Nov-09 2:36 
AnswerRe: SQL querying problem Pin
Emmet_Brown6-Nov-09 3:15
Emmet_Brown6-Nov-09 3:15 
AnswerRe: SQL querying problem Pin
Md. Marufuzzaman6-Nov-09 7:09
professionalMd. Marufuzzaman6-Nov-09 7:09 
QuestionTransferring items from a listbox to a string variable [modified] Pin
gamer11276-Nov-09 0:34
gamer11276-Nov-09 0:34 
AnswerRe: Transferring items from a listbox to a string variable Pin
Covean6-Nov-09 1:03
Covean6-Nov-09 1:03 
AnswerRe: Transferring items from a listbox to a string variable Pin
Eddy Vluggen6-Nov-09 1:14
professionalEddy Vluggen6-Nov-09 1:14 
How manu elements are there in your array? And how many elements would the loop go through?

If your array holds 10 items, then a for-next loop will go from either 1 to 10 or from 0 to 9. Your loop goes 11 times, starting at passedRequest[0] and moving on to passedRequst[10], generating an "index out of bounds". That means that the number between the [] is smaller or larger then the number of items in the array Smile | :)
for (int a = 0; a < lstBoxRequests.Items.Count -1; a++)
Next item is that you're reinitializing the array on each loop. That means that the entire Array is created anew, with a new maximum-upperbound of "a". You'd prolly want a maximum number in the array that corresponds to the number of items in the combobox. That would come to something like this;
int itemCount = lstBoxRequests.Items.Count -1;
string[] passedRequests = new string[itemCount];
for (int a = 0; a < itemCount; a++)
{
    passedRequests[a] = Convert.ToString(lstBoxRequests.Items[a]);

There are easier ways to enumerate through the items, but I'll leave that to the next poster Smile | :)

I are Troll Suspicious | :suss:

GeneralRe: Transferring items from a listbox to a string variable Pin
V.6-Nov-09 1:27
professionalV.6-Nov-09 1:27 
GeneralRe: Transferring items from a listbox to a string variable Pin
Covean6-Nov-09 1:29
Covean6-Nov-09 1:29 
GeneralRe: Transferring items from a listbox to a string variable Pin
Eddy Vluggen6-Nov-09 2:12
professionalEddy Vluggen6-Nov-09 2:12 
GeneralRe: Transferring items from a listbox to a string variable Pin
V.6-Nov-09 2:18
professionalV.6-Nov-09 2:18 
QuestionDrag rectangle using mouse in C# Pin
lexical16-Nov-09 0:31
lexical16-Nov-09 0:31 
AnswerRe: Drag rectangle using mouse in C# Pin
Luc Pattyn6-Nov-09 3:18
sitebuilderLuc Pattyn6-Nov-09 3:18 
GeneralRe: Drag rectangle using mouse in C# Pin
lexical18-Nov-09 21:35
lexical18-Nov-09 21:35 
GeneralRe: Drag rectangle using mouse in C# Pin
Luc Pattyn8-Nov-09 23:10
sitebuilderLuc Pattyn8-Nov-09 23:10 
QuestionJavascript Compatible text from c# text Pin
mmdullah6-Nov-09 0:24
mmdullah6-Nov-09 0:24 
AnswerRe: Javascript Compatible text from c# text Pin
Curtis Schlak.6-Nov-09 10:51
Curtis Schlak.6-Nov-09 10:51 
QuestionMinimize to tray bar [modified] Pin
Ronni Marker5-Nov-09 22:14
Ronni Marker5-Nov-09 22:14 
AnswerMessage Closed Pin
5-Nov-09 22:20
stancrm5-Nov-09 22:20 
GeneralRe: Minimize to tray bar Pin
Ronni Marker5-Nov-09 22:26
Ronni Marker5-Nov-09 22:26 
GeneralRe: Minimize to tray bar Pin
Ronni Marker5-Nov-09 22:37
Ronni Marker5-Nov-09 22:37 
QuestionSystem.Security.RightsManagement Pin
Joe Rozario5-Nov-09 21:52
Joe Rozario5-Nov-09 21:52 
QuestionTextbox-formatting value using databinding Pin
jogisarge5-Nov-09 21:04
jogisarge5-Nov-09 21:04 
QuestionHow I Show MessegeBox in ClassFile in C#.net Pin
Vikash Yadav5-Nov-09 20:23
Vikash Yadav5-Nov-09 20:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.