---
title: "How to find a Row in Datagridview and update it"  
description: "How to find a Row in Datagridview and update it"  
author: "Anonymous User"  
published: 2014-01-28  
updated: 2014-01-28  
canonical: https://www.mindstick.com/forum/1895/how-to-find-a-row-in-datagridview-and-update-it  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How to find a Row in Datagridview and update it

I can show data in [GridView](https://www.mindstick.com/articles/873/update-delete-edit-gridview-in-asp-dot-net), now I need find a row with [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) in [DataGridView](https://www.mindstick.com/articles/607/working-with-datagridview-in-vc-sharp) so the [cursor](https://www.mindstick.com/articles/13003/create-a-simple-cursor-in-sql-server) moves to this row, get this row and [update](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) the [field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) (I want updated [fields](https://www.mindstick.com/forum/159126/sql-query-for-all-tables-and-fields-in-an-oracle-db) in a [textbox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) on the form , after update), show updated row in datagridview and cursor move to next row automaticaly

Can [someone help me](https://answers.mindstick.com/qa/42311/can-someone-help-me-with-this-question-about-political-parties)?

## Replies

### Reply by Pravesh Singh

Hi Jeet,\

let's say you'r binded data artifact (class is MyData)

```
public class MyData{    public string Name {get;set;}   public string Address {get;set}}
```

so yuo have somewhere a collection of of MyData like List<MyData>

List<MyData> myDataList = new List<MyData>();

and do somewhere in the code, I presume, something like this:

dataGrid.DataSource=myDataList

Now, yo want to find some row on DataGrid, but you really want is to find a data. So, make a query over the myDataList to find MyData object of interest, let's say like this

var foundMyData = from data in myDataList where (. condition..) select data;

We found the data we interested in, so no let-\'s make it selected on UI. So find the index of the foundMyData in the list and select corresponding row on the grid.

If you use Sorting, or View so the data visible on the screen can be filtered or sorted, you need to consider that "transformations" too, naturally.


---

Original Source: https://www.mindstick.com/forum/1895/how-to-find-a-row-in-datagridview-and-update-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
