Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am working on performing some statistical calculations with data in datagridview in VB.net. MY datagridview is connected to an Access data base where all my data is stored. Using a set of instructions I will call the data from access into datagridview. After performing some calculations I need to replace values in my datagridview with other values. I am unable to figure out how to do this.

Sample data in my datagridview is

X1_ X2_ X3_ Yj
1_ 1_ 2_ 5
1_ 2_ 1_ 6
2_ 1_ 1_ 7
2_ 2_ 2_ 8

(PS: I am using the underscore to make the data format properly in this post. Under score has nothing to do with my data in Datagridview)

After few calculations in this data I would like to replace values under columns X1, X2 and X3. For example I want to replace the 1's under X1 with 50 and the 2's under X1 with 2. Please find the mapping table below

X1 1 replace with 50
X1 2 replace with 100
X2 1 replace with 75
X2 2 replace wit 25
X3 1 replace with -1
X3 2 replace with 1


If I can get a heads up about this it will be very helpful.
(Pardon my jargon I am a new programmer)

Thanks in advance
Posted
Updated 16-Mar-10 0:01am
v3

inam,avi wrote:
(Pardon my jargon I am a new programmer)


Then this is way too complex for you. I trust you're doing this for a class, if you're being paid for it, it's an utter disgrace. You should talk to your teacher for specific help, but the answer with any data bound control, is to update your data and then bind again.
 
Share this answer
 
Comments
memchip 31-Aug-11 8:36am    
Hey Chris, why don't you go f$#k yourself
It seems to me that you would want to change the data itself (you still have it in memory), and then simply refresh/rebind the DataGridView.

So, you'd need to iterate through the rows in the dataset, change the values, and Bob's your uncle.
 
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