【发布时间】:2016-01-07 08:20:21
【问题描述】:
因此,我试图通过 Button Click 上的 DataGridView 将所有行从一个表单传递到另一个表单。从frm_1.vb中的grd_order到frm_2.vb中的grd_invoice
这是我能做到的,因为我还是 vb.net 的新手
frm_1.vb
Private Sub btn_purchase_Click(sender As System.Object, e As System.EventArgs) Handles btn_purchase.Click
Dim newForm As New frm_2
newForm.AllRows = grd_order.DataSource
'what should i put here because the above line is wrong
newForm.Show()
End Sub
frm_2.vb
Public Class frm_2
Public Property AllRows As DataGridViewSelectedRowCollection
'I know that DataGridViewSelectedRowCollection is used for the specific row but what about all rows?
Private Sub frm_2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'grd_invoice.DataSource = PassText
'what should i put here
End Sub
End Class
【问题讨论】:
-
您的
DataGridView的DataSource是什么? -
@RezaAghaei 是动态DataGridView吗?最初来自
DataTable。其实和我之前的问题有关:stackoverflow.com/questions/34648049/…
标签: .net vb.net winforms datagridview