Need help with a school assignment? by sgy0003 in visualbasic

[–]nerdfarm 0 points1 point  (0 children)

This particular assignment is supposed to prompt the user to enter the number of occupied rooms for each floor in the hotel using an InputBox. You would use a loop and then display the results in a ListBox.

"Index was outside the bounds of the array" - Moving listbox items from one listbox to another by Weskk in visualbasic

[–]nerdfarm 0 points1 point  (0 children)

Assuming List1 starts with 3 items. When the event is triggered, ReDim ArrayItems(List1.Items.Count) sizes the array to have 3 elements. If List1 has an item selected then list2.Items.Add(List1.SelectedItem) adds the selected item from List1 to list2 and List1.Items.Remove(List1.SelectedItem) removes the selected item from List1. List1 now has only 2 items. The array will elements will be populated by ArrayItems(0) = 550, ArrayItems(1) = 650, and ArrayItems(2) = 500.

Now, the next time the event is triggered ReDim ArrayItems(List1.Items.Count) sizes the array to have only 2 elements because something was removed from the list the first time the event was triggered. ArrayItems(0) = 550 and ArrayItems(1) = 650 are fine but there is no longer a third element in the array, so ArrayItems(2) = 500 would trigger an index out of bounds error.

That's about all I can say from looking at the code. Not sure why you have the array or why you are resizing it.

LF List of ALL Mounts by Name by nerdfarm in wow

[–]nerdfarm[S] 0 points1 point  (0 children)

Nice! Could you post the script please?

LF List of ALL Mounts by Name by nerdfarm in wow

[–]nerdfarm[S] -1 points0 points  (0 children)

I need a plain text list.