好吧我完全新的WinForms,我試圖找到DataGridView1我通過如何查找另一種形式的DataGridView?
frmPledgeCreation.Controls.Find("DataGridView1", True)
另一種形式有一個表格(frmPledgeCreation)上的問題是,當我檢查的行數第二種形式的DataGridView1 ...即使在frmPledgeCreation的DataGridView1中有許多行時,我也總是得到1。
是frmPledgeCreation.Controls.Find("DataGridView1", True)
創建一個新的實例? 我的目標是建立從這個其他形式的這樣的事情該DataGridView中的特定列的單元格的值...
DGV.Rows(Convert.ToInt32(gDGVindex)).Cells("SecurityName").Value = GstrSearchResult.ToString()
其中gDGVindex
是它具有rowIndex的全局變量..但我總是出現超出範圍的錯誤。
將該DataGridView1公開並在其他窗體上使用。對於進一步的數據,你可以參考綁定到datagrid視圖的數據源 – Swati
請發佈你的實際代碼。這是如此令人困惑的說什麼。順便說一下'ControlCollection.Find'方法在這種情況下不是你想要的。 –