Listbox with 1000+ Visual Studio Freeze Elements

I have a list with 1091 items that I add at design time. Every time Visual Studio tries to save after I manually fill in the list, it will hang indefinitely. Is there any way around this, I'm trying to add too many elements to the list?

thank

+5
source share
3 answers

Instead of doing this manually by city at design time, I would just iterate over a text file (or file or database) at runtime and add all the cities to the list, which is then used to populate the list.

, , .

. . . . , , - , .

# ( ), , . Resource1 cityListTextFile.txt Resource1. :

string cityList = Resource1._cityListTextFile;

cityListTextFile.

VB.NET # .

+5

? , VisualStudio .

+1

You can prevent the list from being overwritten when it is updated:

 listBox1.BeginUpdate()
 Dim num As Integer
 For num = 1 To 3000
     listBox1.Items.Add("Item " & num.ToString())
 Next num
 ' End the update process and force a repaint of the ListBox.
 listBox1.EndUpdate()
0
source

All Articles