Click here to Skip to main content
12,550,379 members (45,427 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# DataGridView
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;

Posted 6-Jun-11 22:32pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 7 Jun 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100