Solved

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

Posted on 2011-03-01
2
444 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

691 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