Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a DataGridView that is bound but it also has several unbound columns. I'm calculating the values in some of these unbound cells through values on the form including other cells that are bound.

I can successfully set the value of a cell, however, under no circumstances is the value being reflected on the UI. I've checked the value on the proper cells as I exit the method and they are correct. I've tried refreshing and updating, but still nothing appears on the front end.

Can anyone tell me why the UI is not showing the values?
This is using Winforms and not WPF if it matters.


I'm doing this in the usual way,

dgv.Rows[i].Cells[j].Value = val;

TIA
Posted

1 solution

 
Share this answer
 
v2
Comments
Mustafa Ismail Mustafa 7-Jun-11 7:48am    
Well, there are initial calculations that I need to perform and these ought to happen at Form_Load(). I'll try to do that at the DatabindingComplete() event and come back with an answer
thatraja 7-Jun-11 8:00am    
For initial calculations, you can do calculations in Datatable/dataview & then you can bind that to Datagridview.
Check my updated answer.
Mustafa Ismail Mustafa 7-Jun-11 7:53am    
It worked! The question is why?! Why should it matter that I used an event to set the value whilst I cannot do it explicitly?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900