Click here to Skip to main content
15,908,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagridview with 4 columns. In first column,there is a textbox and the value is coming from the checkedlistbox ie outside the datagridview. Now in second column there is a combobox and in that, value is manually filled. And in third column there is textbox and i'll fill the value and after that in fourth column,the value will be (Column2*column3) that is automatically comes after the calculation. So how how can i fill value automatically in column fourth. pls help me.
Posted
Updated 20-Nov-13 23:49pm
v2

1 solution

Since there's a grid, I suppose you have multiple rows in it. Otherwise this could be overkill:

Change your way of thinking from a UI-centric model to an object oriented model.

So you have an object with four properties. Actually, you have a class with four properties that you will instantiate multiple times. Group those objects in one BindingList<t>[^] where T is your class.

Implement the desired behaviour (computation of 4th property based on first three properties).

Bind the BindingList to your Grid, to the CheckedListBox, to whatever. All those UI elements should work on the same data (which is the underlying list of objects). Since all UI-induced changes affect that same data, changes of the data get displayed in all bound UI elements.

I'm not sure, but eventually you have to implement the INotifyPropertyChanged[^] interface for your object.
 
Share this answer
 

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