T
Tolgan
I have an object class "Person" say, with various public properties
including say "Name" and "Salary"
I have several person objects that I have created by some method outside the
scope of this discussion.
I want to setup a datagridview with each row corresponding to one person
object, and two columns being "Name" and "Salary". I want the user to be
able to click on the column heading to sort rows based on values in that
column. Users are not permitted to add to change rows, though can select
rows as operands to other operations.
This feels like it should be straightforward by setting up a collection of
persons as a datasource property either of the dataviewcontrol itself, or of
a bindingsource (which is then itself attached to the datagridview). However
whenever I go this route I seem to lose the (user) ability to sort on column
values.
Or, I can just add rows of {person.name, person.salary} pairs directly to
the datagridview but this is not very satisfactory as when the user selects
I want to get back the person object, not just the name and salary values.
What am I missing?
including say "Name" and "Salary"
I have several person objects that I have created by some method outside the
scope of this discussion.
I want to setup a datagridview with each row corresponding to one person
object, and two columns being "Name" and "Salary". I want the user to be
able to click on the column heading to sort rows based on values in that
column. Users are not permitted to add to change rows, though can select
rows as operands to other operations.
This feels like it should be straightforward by setting up a collection of
persons as a datasource property either of the dataviewcontrol itself, or of
a bindingsource (which is then itself attached to the datagridview). However
whenever I go this route I seem to lose the (user) ability to sort on column
values.
Or, I can just add rows of {person.name, person.salary} pairs directly to
the datagridview but this is not very satisfactory as when the user selects
I want to get back the person object, not just the name and salary values.
What am I missing?