datagrid event question

I'm trying to change the value of one column based on what the user typed in another column.
So if they enter in A in the first column, the second column shows "Apple".  
I can't seem to figure out what event I should be keying off of.

Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use the CurrentCellChanged event of the DataGrid
Now here you can check whether in your particular column the user has typed A or B

Now remember, in order to set the corresponding value of Apple and Boy in the other column you'll need to assign the value to the particular column of the particular row in the Underlying table.

DennisLAuthor Commented:
My issue with CurrentCellChanged is that it fires everytime when you navigate through different cells.  And you can't seem to find out what the last column or row that you were in.  This program will be querying a database to populate the second column, so I don't want to be refreshing every column/row everytime the user navigates through the cells.
hi try this

in the currentcellchanged event and also rembember that rownumber begins with 0 and column numbers also begins with 0
so row 1 is 0 and column 1 is also 0

dim r as integer
dim rowval as string
r = DataGrid.CurrentCell.RowNumber
rowval=datagrid.Item(r, 0) 'this gets the value in column 1
if rowval="A" then
datagrid.Item(r, 1)="Apple" ' this sets the value for column 2
end if
You'll need to check whether user has selected a new Row or if he has just changed cells within the same row

For this keep a variable at Form Level wherin you'll have


then in CellChanged event check if
current DataGrid.CurrentCell.RowNumber is equal to the previous value or not


Dim LastRow as Integer

Then on CurrentCellChanged

If Not LastRow=DataGrid.CurrentCell.RowNumber then
   LastRow=DataGrid.CurrentCell.RowNumber 'Store this value for next usage
   If DataGrid.CurrentCell.ColumnNumber=1 Then 'Your Column No. Here
         'Now Set the Value for the grid
   End If
End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DennisLAuthor Commented:
Not exactly what I was looking for, but it does work and gave me some ideas.

I don't think I'll be using the datagrid for my next project.  haha.

Thanks for the help and sorry for accepting so late.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.