Link to home
Start Free TrialLog in
Avatar of PNRT
PNRT

asked on

In VB.Net compare value from DataGridView and return other value

Hi experts.   In VB.Net, 2008 and .Net 3.5.  I have a datagridview with 6 columns.   I need to iterate through column 1 and if a match is found to a string, then get the value from the same row but column 2.  An example would be appreciated.  Many Thanks in advance    
Avatar of Mrunal
Mrunal
Flag of India image

you can use findcontrol method of gridview datarow through looping to gridview rows (can aslo be in rowdatabound event ) for that particular value which you want for comparing also and for taking also.

Hope you get what i mean.
Avatar of PNRT
PNRT

ASKER

Hi, thanks for the reply.  I checked the findcontrol message but cant seem to see the relevance.  Im trying to get the cell value of one cell based on the contents of another cell.   Sorry if I was not clear.
I was looking for something like

for each row in datagridview1
if cell in column 1 = x then same row, column 2 = y
next

But unfortunately, I wasnt able to get that right.  Is the above not the right way to achive this.
ASKER CERTIFIED SOLUTION
Avatar of Mrunal
Mrunal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial