5 Years
Discussion Span
Last Post by HibaPro

Hi, this is a way to do it

Private Sub DataGridView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseClick
        If DataGridView1.CurrentCell.Selected = True Then
            DataGridView2.Visible = True
        End If
    End Sub

U have asked same kind of question in one of your other thread. Dont you follow the answer?


thats very helpful code , now i need to add this code but it gives an error:

Private Sub MaterialDDataGridView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MaterialDDataGridView1.MouseClick

    If MaterialDDataGridView1.CurrentCell.Selected = True Then
        MaterialClassificationDGV.Visible = True
    End If
    Dim i As Integer
    i = MaterialDDataGridView1.CurrentRow.Index

    MaterialClassificationDGV.CurrentRow.Cells(0).Value = ((MaterialDDataGridView1(0, i).Value()))

End Sub

Object reference not set to an instance of an object. this is my error , how i can fix it ? 

ok , sry again , i fix the problem by add this code :

Private Sub DataGridView1_RowsAdded(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles DataGridView1.RowsAdded

    If e.RowIndex >= 1 Then
        Dim i As Integer
        i = DataGridView1.CurrentRow.Index.ToString

        DataGridView1.Rows(e.RowIndex - 1).Cells(0).Value = DataGridView1.CurrentRow.Cells(0).Value()

    End If
End Sub

now i need to ask how i can concate the DataGridView1.CurrentRow.Cells(0).Value() with integer value that increment by 1. 

thanx in advance 
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.