M
Michael
Hello,
After 2 years i come back to DOT NET development, so it is a little bit hard
in the beginning.
Here is my problem :
I have a table with a field whixh tells me if a person is a boy or a girl,
it is a boolean (0 or 1).
In my window application, i want to show a list of person, and i do it
dynamically when the datagrid is created. I have not associated a Datasource
with any wizard, i do it manually in the code.
At first, i had a column with checkboxes to represent my Sex field value,
quite logic for the moment, but i wanted to show "Boy" or "Girl" instead.
So i add a new column to my dataset, with the expression : IIF(Sexe, 'Boy',
'Girl'), this is working fine.
But now i want to hide the original column (Sexe field) in my datagrid, but
i can't find a way to do it, as there is no "Datacolumns" or
"DataColumnCollection" property in System.windows.forms.Datagrid.
Here is a piece of code :
//Ajout de la colonne Garçon/Fille
System.Data.DataColumn cSexe = new System.Data.DataColumn();
cSexe.ColumnName = "Genre";
cSexe.Expression = "IIF(Sexe, \'Garçon\', \'Fille\')";
cSexe.ReadOnly = true;
monDS.Tables["Competiteur"].Columns.Add(cSexe);
this.dgCompetiteurs.DataSource = monDS.Tables["Competiteur"];
Thanks in advance for all your answers.
Michael
After 2 years i come back to DOT NET development, so it is a little bit hard
in the beginning.
Here is my problem :
I have a table with a field whixh tells me if a person is a boy or a girl,
it is a boolean (0 or 1).
In my window application, i want to show a list of person, and i do it
dynamically when the datagrid is created. I have not associated a Datasource
with any wizard, i do it manually in the code.
At first, i had a column with checkboxes to represent my Sex field value,
quite logic for the moment, but i wanted to show "Boy" or "Girl" instead.
So i add a new column to my dataset, with the expression : IIF(Sexe, 'Boy',
'Girl'), this is working fine.
But now i want to hide the original column (Sexe field) in my datagrid, but
i can't find a way to do it, as there is no "Datacolumns" or
"DataColumnCollection" property in System.windows.forms.Datagrid.
Here is a piece of code :
//Ajout de la colonne Garçon/Fille
System.Data.DataColumn cSexe = new System.Data.DataColumn();
cSexe.ColumnName = "Genre";
cSexe.Expression = "IIF(Sexe, \'Garçon\', \'Fille\')";
cSexe.ReadOnly = true;
monDS.Tables["Competiteur"].Columns.Add(cSexe);
this.dgCompetiteurs.DataSource = monDS.Tables["Competiteur"];
Thanks in advance for all your answers.
Michael