Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

20 Experts available now in Live!

Get 1:1 Help Now