C# - ListBox DataSource property and binding an ArrayList -


I have created an ArrayList, in which KeyValuePair & lt; String, string & gt; Objects The listboxes are those boxes that I would like to attach to that list so that I do not have to fill them by repetition, at the same time there is a need to copy all the data present in the above ArrayList.

I use a Delfie programmer and in Delphi I will use ListView control, set my OwnData property to right and then specify an object to create a specified item (with a specified index) Use the OnData event, display any data from an array item with the same index, the ondata method gives me the currently displayed item as a parameter, Used for drawing, its index, caption, and sub-items properties can be based on that index, I can display some data from an array item with the same index. If that array is modified, then the list is enough to refresh the view and / or calculate the property if the length of the array has changed.

How to achieve the same goal in C # using ListBox control? I have set the listBox.DataSource property with MyArrayLists with KeyValuePairs. Now I would like to show the list box the keys of the keyway Pace object.

In the .NET list box it has built-in functionality. You have already set up the DataSource property, so set the list to show only the keys:

  listBox.DisplayMember = "key";  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -