Calling Forms

JesseH

Active member
Joined
Feb 9, 2006
Messages
42
Location
Sugar Land, TX
Programming Experience
10+
I have a MDI form. It calls another form. This works fine. I am trying to call another form from the second form. That does not work. Idea: MDI form has Major Selections - Inventory, Accounting, Payroll. Second form has Inventory selections - Inventory Master File Inquiry, Inventory class Inquiry, etc. Third form has actual Inventory Master file inquiry. Can anybody tell me how to accomplish this?

Thanks in advance.
 
Thanks for the question.

From the Child form (called from MDI form) the statment below does not work.
I know the grand child form works because I can "debug" it. I know the Child works because I can "debug" it also.




Dim wInvItemSelected As String
Dim wIndex As Integer
wIndex = lstInvInqSelect.SelectedIndex
If wIndex = 0 Then
Dim frm As New frmInvClassInq <=======
frm.Show() <===== Does do not show the form
Close()
End If
 
Hello.

I'd say that it can't be displayed 'cause it's declared as a local variable, which should stop existing after the sub/function ends.

Why are you instancing it anyway? Do you need the form more than one time? If not just call it like you call every other form. If you need it more than one time, you'll have to find a workaround, like creating an Array or ArrayList which is holding your instances.

Bobby
 
Bobby, I tried removing the "new" and it failed anyway. Can you tell me in the MDI form the processing returns when the child form closes. The idea would be to store the form that I needed and when I return to the parent launch that form.

Thanks
 
Minimize it. :)
No seriously, there are some ways to achieve 'storing' a form until a certain condition.
The first would be to set the form invisible until you need it again (maybe you'll need to capture the FormClosing event and cancel it).
You could also save it down to a new instance, f.e.
VB.NET:
Dim savedForm As frmInvClassInq = frmInvClassInq
, and recall it this instance if needed.
You could also save the id of the data which was in the form, close the form and then recall a new form and fill it with that data. Meanin that you just call frmInvClassInq.Show() and .Close().

I'd go with the invisible thing.

Bobby
 
Back
Top