Solved

How do I copy the value from one datagridview cell into another cell in the same row?

Posted on 2011-03-01
2
439 Views
Last Modified: 2013-11-26
This is what I am trying (and failing miserably) to do...

A user has entered a new row in my datagrid. Once they type in a value into the first cell in that row, I want to pre-populate 3 other cells in the row with the same value.

I tried to use the Cell_Leave event and its just raining bombs over here :-(

0
Comment
Question by:imonfireDAMMIT
2 Comments
 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
ID: 35012467
try the cellendedit

    Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
        If e.ColumnIndex = 1 Then
            Me.DataGridView1.Item(2, e.RowIndex).Value = Me.DataGridView1.Item(1, e.RowIndex).Value
            Me.DataGridView1.Item(3, e.RowIndex).Value = Me.DataGridView1.Item(1, e.RowIndex).Value
            Me.DataGridView1.Item(4, e.RowIndex).Value = Me.DataGridView1.Item(1, e.RowIndex).Value
        End If
    End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:imonfireDAMMIT
ID: 35017096
Thank YOu  :-) that was extremely helpful. I tweeked the code slightly to fit my particular grid and it worked great!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now