我正在尝试从包含DataGridView的子窗体传递变量,我正在调用一个函数来执行操作,但我不能单独成功函数获取值但不会改变窗体的datagridview父,我正在使用的代码是:
Invoice_new(父表格):
Controls:
DatagridView: invoice_items
Public WriteOnly Property ValueFromChild() As String
Set(ByVal Value As String)
MsgBox(Value) 'Work
With Me.invoice_items
.Rows.Add() 'Does not WORK
.Item(0, 0).Value() = Value 'Does not WORK
End With
End Set
End Property
invoice_new_search_item(儿童表格)
Controls:
DatagridView: search_items
invoice_new.ValueFromChild() = search_items.Item(0, current_row).Value
答案 0 :(得分:1)
参见CType Funcion:
CType(your_parent_form.ActiveMdiChild, your_childform).invoice_items.Item(0, 0).Value