Populating ListBox with a List(T) Class. Not using datasource

Ryan Walkowski

I have the following list

static List<SectorBodies> MatchList = new List<SectorBodies>();

And it's associated class

public class SectorBodies
{
    public int MatchCount { get; set; }
    public string StringPosition { get; set; }

    public string SolarSystemFileComment { get; set; }
    public string SolarSystemX { get; set; }
    public string SolarSystemY { get; set; }
    public string SolarSystemZ { get; set; }

    public string OuterFileComment { get; set; }
    public string OuterOrbitX { get; set; }
    public string OuterOrbitY { get; set; }
    public string OuterOrbitZ { get; set; }
    public string OrbitName { get; set; }
    public string OrbitPrefab { get; set; }

    public string PlanetFileComment { get; set; }
    public string PlanetX { get; set; }
    public string PlanetY { get; set; }
    public string PlanetZ { get; set; }
    public string PlanetName { get; set; }
    public string PlanetBiome { get; set; }
    public string PlanetIsStart { get; set; }
}

The following is the watch list to give scope of whats inside enter image description here

I am trying to populate a ListBox with a list element named as OrbitName without using the datasource bind as I would prefer to do manipulation of the results before populating. I am aware of listBox1.Items.Add() but i cant seem to populate it properly it just populates the listbox with the namespace.class in my case Parser.SectorBodies. So how do i using the Items.Add method add all the OrbitName into the ListBox

BugFinder

You could do

foreach(var item in MatchList) listbox1.Items.Add(item); listbox1.DisplayMember="OrbitName";

this will display the OrbitName for each item.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Populating ListBox with List of <class> VB.NET

From Dev

ListView Populating using Custom Class

From Dev

Populating a programatically declared datagridview using datasource and entity framework

From Dev

Populating ListBox using parameterized query on VB.Net

From Dev

Textblock in Listbox not populating with values

From Dev

Populating custom class properties using Reflection

From Dev

How to refresh DataSource of a ListBox

From Dev

Unbind datasource after populating combobox

From Dev

Using .NET Class as the DataSource with SSRS RDLC

From Dev

Populating a listbox by comparing another listbox value

From Dev

KendoUI - Populating a Grid using a DataSource that reads from a WebAPI 2 ApiController returning PageResult<T>

From Dev

Populating a ListBox from row array

From Dev

populating listbox from selection, python

From Dev

WCF To WPF client - Populating the ListBox

From Dev

Populating values of a struct inside a class using push_back

From Dev

Populating values of a struct inside a class using push_back

From Dev

Listbox for MVC 6 EF 7 Property not Populating

From Dev

Populating Selected Items From Database to MultiSelect Listbox

From Dev

C# Populating listbox with byte array

From Dev

Populating Listbox with Jquery calls onClick two times

From Dev

C# Populating listbox with byte array

From Dev

Remove value from range populating my listbox

From Dev

Populating listbox with only one content from several

From Dev

Populating a DTO class with linq

From Dev

C++populating base class protected member using derived class constructor

From Dev

SQL Statement as datasource for listbox VB.NET

From Dev

Accessing the listbox object and using it as a string globally in my class

From Dev

Adding items to a listbox on a different class in C# using a second form

From Dev

xml not populating - using JAXB

Related Related

  1. 1

    Populating ListBox with List of <class> VB.NET

  2. 2

    ListView Populating using Custom Class

  3. 3

    Populating a programatically declared datagridview using datasource and entity framework

  4. 4

    Populating ListBox using parameterized query on VB.Net

  5. 5

    Textblock in Listbox not populating with values

  6. 6

    Populating custom class properties using Reflection

  7. 7

    How to refresh DataSource of a ListBox

  8. 8

    Unbind datasource after populating combobox

  9. 9

    Using .NET Class as the DataSource with SSRS RDLC

  10. 10

    Populating a listbox by comparing another listbox value

  11. 11

    KendoUI - Populating a Grid using a DataSource that reads from a WebAPI 2 ApiController returning PageResult<T>

  12. 12

    Populating a ListBox from row array

  13. 13

    populating listbox from selection, python

  14. 14

    WCF To WPF client - Populating the ListBox

  15. 15

    Populating values of a struct inside a class using push_back

  16. 16

    Populating values of a struct inside a class using push_back

  17. 17

    Listbox for MVC 6 EF 7 Property not Populating

  18. 18

    Populating Selected Items From Database to MultiSelect Listbox

  19. 19

    C# Populating listbox with byte array

  20. 20

    Populating Listbox with Jquery calls onClick two times

  21. 21

    C# Populating listbox with byte array

  22. 22

    Remove value from range populating my listbox

  23. 23

    Populating listbox with only one content from several

  24. 24

    Populating a DTO class with linq

  25. 25

    C++populating base class protected member using derived class constructor

  26. 26

    SQL Statement as datasource for listbox VB.NET

  27. 27

    Accessing the listbox object and using it as a string globally in my class

  28. 28

    Adding items to a listbox on a different class in C# using a second form

  29. 29

    xml not populating - using JAXB

HotTag

Archive