View Single Post
  #4 (permalink)  
Old 01-05-2009, 6:06 AM
Blesson Blesson is offline
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Age: 23
Posts: 18
Reputation: 17
Blesson is on a distinguished programming path ahead
Default Got it

Hi,
I got it . the code i used is :


Code:
Private Sub DataGridView1_CellValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged

    If Me.Visible = True Then


        Dim ColumnIndex

        ColumnIndex = DataGridView1.CurrentCell.ColumnIndex
        If ColumnIndex = 2 Then
            IndexValue = DataGridView1.CurrentRow.Cells(2).Value
            DataGridView1.CurrentRow.Cells(3).Value = IndexValue
            DataGridView1.CurrentRow.Cells(4).Value = IndexValue
        End If
        If ColumnIndex = 3 Then
            IndexValue = DataGridView1.CurrentRow.Cells(3).Value
            DataGridView1.CurrentRow.Cells(2).Value = IndexValue
            DataGridView1.CurrentRow.Cells(4).Value = IndexValue
        End If
        If ColumnIndex = 4 Then
            IndexValue = DataGridView1.CurrentRow.Cells(4).Value
            DataGridView1.CurrentRow.Cells(2).Value = IndexValue
            DataGridView1.CurrentRow.Cells(3).Value = IndexValue
        End If
    Else
        Exit Sub
    End If
End Sub

Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
    DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
End Sub
How do i add the values of a particualr column in VB.NET ( Visual studio 2008, .NET3.5)
Reply With Quote