Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another MDI Child Form question

Status
Not open for further replies.

jpack23

Programmer
Dec 15, 2004
82
US
I have a Child form that opens up in a Main MDI form. I enter information in txtboxes on this child form and then use a save button on the MDI to save the info to a database. When the save is successful an ID number is assigned. I want to get the ID number on the child form. the problem I am having is getting the Child form refocused or active without clearing any of the text boxes so I can make a call to the property holding that ID number and then put the ID number on a label on the child form. Any suggestions? thank you for your help
 
There are generally better ways to do it depending on how the child is created but you could get all of the current child forms then you would need to look for something specific on that form.

Code:
Dim chldFrms As Form() = Me.MdiChildren

For Each chldFrm As Form In chldFrms
    'Look for something on the form then set the label if it is the correct form.
Next

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
You can also use ActiveMdiChild to get the child form that is currently active. But as Sorwen this may not be the best approach. I personally put the save button on the child form not the Mdi parent form.

Code:
dim chldFrms as Form() = Me.ActiveMdiChild
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top