0

I have a form called frmDSNMain and another form called frmChainedRun I want to access the DataGridView present in the frmChainedRun form from the frmDSNMain form. I tried to call directly by the form name as frmChainedRun.gridName.Rows.Count from the DSNMain. But I am not able to fetch:

If frmChainRun.rbtnPredefinedModule.Checked = True Then
    If frmChainRun.grdPredefined.Rows.Count > 0 Then
        For Each row As DataGridViewRow In frmChainRun.grdPredefined.Rows
            Dim isSelected As Boolean = Convert.ToBoolean(row.Cells(0).Value)
            If isSelected Then
                row.Cells(0).Value = False
            End If
        Next

    End If

ElseIf frmChainRun.rbtnCustomModule.Checked = True Then

End If
Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Mahantesh
  • 429
  • 6
  • 13
  • [Interaction between forms — How to change a control of a form from another form?](https://stackoverflow.com/questions/38768737/interaction-between-forms-how-to-change-a-control-of-a-form-from-another-form) – Reza Aghaei Oct 13 '16 at 04:07
  • There are multiple useful options in the linked post with some examples. The linked post is also linked to some other useful answers which describe how you can access controls of an other form. The most simple option for you probably is making the `DataGridView` public, so you can easily use its properties. But it's not the best option. – Reza Aghaei Oct 13 '16 at 04:09

0 Answers0