Solved

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

Posted on 2011-03-01
2
440 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 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