If I have a list of strings, eg:
List<string> MyList = new List<string>();
MyList.Add("HELLO");
MyList.Add("WORLD");
Is there an easy way to populate a ListBox using the contents of MyList?
If I have a list of strings, eg:
List<string> MyList = new List<string>();
MyList.Add("HELLO");
MyList.Add("WORLD");
Is there an easy way to populate a ListBox using the contents of MyList?
Try :
Have a look at ListControl.DataSource Property
This also could be easiest way to add items in ListBox.
Further improvisation of this code can add items at runtime.
Is this what you are looking for:
You can also use the
AddRange
method