how i can make the cell on my DGV linked to other DGV ???

Recommended Answers

All 6 Replies

What you mean by linked to?

when i click on some cell on my DGV i need to appear other DGV

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 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.