S.M.Oth
S.M.Oth

Reputation: 35

how to pass variables value from dialog form to child form without close the dialog form in vb.net

i have (mdi parent form) and (childs form) in child form i have datagridview with columns (code,description,qty) which get its data from dialog form properties how i can pass dialog form properties to child datagridview without closing the dialoge

in child i can use this

Private Sub ItemsLookupTile_Click(sender As Object, e As EventArgs) Handles ItemsLookupTile.Click
    If ItemsLookupForm.ShowDialog(Me) = Windows.Forms.DialogResult.ok Then
        Me.Grid.Rows.Add(ItemsLookupForm.code,ItemsLookupForm.description,ItemsLookupForm.qty)
    End If
End Sub

but in the above code dialog form closed and the user must click the button again to add another item , i tried to use

Windows.Forms.DialogResult.None

but it did not work

Upvotes: 1

Views: 322

Answers (1)

tinstaafl
tinstaafl

Reputation: 6948

One thing you can do is have a class representing a row in the datagridview and pass a list of that class to the dialog form in the constructor. Now the dialog can fill the list before it's closed and the child form can access the list when the dialog is closed.

You could try accessing the datagridview directly but the result will be the same the additions won't show up until the dialog is closed.

Upvotes: 1

Related Questions