0
I have a Model class:
class pessoaModel
{
int id;
DateTime data;
TimeSpan hora;
CliModel ID_Cliente = new CliModel ();
public string Nome
{
get { return nome; }
set { nome = value; }
}
public int ID
{
get { return id; }
set { id = value; }
}
public TimeSpan Hora
{
get { return hora; }
set { hora = value; }
}
public DateTime Data
{
get { return data; }
set { data = value; }
}
public CliModel cliModel
{
get { return CliModel ; }
set { CliModel = value; }
}
}
Which is filled in through the information recorded in the database. I need my Displaymember to have the Name + Date + Time + Climodel.Name And I need Valuemember to match ID.
I’m trying to do it this way
chkAtendimento.DataSource = listaAtendimento;
chkAtendimento.DisplayMember = "Nome" + "Data" + "Hora" + "CliModel.Nome"
chkAtendimento.ValueMember = "Id";
But the information I put in doesn’t show up. How I make information appear the way I need it?
"Gets or sets a string that specifies a Property of the Objects contained in the list box Whose Contents you want to display." The Member display must be a property of your datasource. If possible, create a property with a get { Return Name + Date + Time + Weather };
– Vinícius
There’s no way to concatenate?
– Tozzi
Not with Displaymember. Another possibility is to create an anonymous property to represent Displaymember.
– Vinícius
how I would create an anonymous property to represent Displaymember.
– Tozzi