Hi, I'm trying to make a datagridview where one of the columns has a combo box TcType {Fuera de Servicio, Normal)
( Canton Type) . The code to fill in the datagrid view is as follows:
dataGridViewTcCnf.DataSource = ConfData2.TcCnf.TcCnfArray.ToList();
Where my TcCnfArray array is an array of 16-position sTcCnf objects where the attributes of sTcCnf are: IdTc, TcType (is the one that I have linked with the combobox), NumUv, NumUvNormalizacion, IdUvNormalizacion and TcFlags.
When in my array in the position of TcType there is a 0 I want it in the comboBox to put out of service and when there is a 1 that sets Normal. How do I assign it? I have created the column in the datagridview with the combobox and the collection is what I said.
To do the conversion in reverse I do the following:
ConfData.TcCnf.TcCnfArray[index].TcType = Convert.ToByte(dataGridViewTcCnf.Rows[index].Cells[1].Value);
It tells me that the value is not valid for the datagridview. I do not know how to assign to the combo box column of the data grid view that when you get a 0 it means that the combo box selected index is 0 and you write Out of Service.
The combobox column Canton Type has the following properties. I have to configure one of these fields so that when an integer arrives at that position of the datagridview, the corresponding item is written with the integer truth? What would it be?
My datagridview is as follows:
How do I assign that when I read 0 write / select Out of service and that when I get 1 type / select normal? What should I put in ValueMember or DisplayMember to make this assignment?
When instead of having a combo box in the Canton Type column I have a text box, my result of reading the information of the TcCnfArray array is as follows:
This result would be correct only I have filled the first three positions of the array what happens is that I do not want to see a 1 in that column I want to see "Normal". I have all the DataPropertyName of the columns assigned with the values of the sTcCnf object.