|
-
Jan 15th, 2004, 09:55 AM
#1
Thread Starter
Frenzied Member
mdi closing child
I need to close a child form when a button is clicked on another child form.
I'm using:
pcms.frmDataEntry1.Close() - on the click event but get an error
Object reference not set to an instance of an object.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jan 15th, 2004, 01:46 PM
#2
Addicted Member
Just use a loop:
Dim frmMain as Form=Me.MdiParent
Dim frm as Form
If frmMain.MdiCHildren.Length > 0 then
For Each frm in frmMain.MdiChildren
If frm.text="Data Form" then
frm.close()
End IF
Next
End If
-
Jan 20th, 2004, 09:12 AM
#3
Thread Starter
Frenzied Member
thanks.
another question...how can I call a procedure in different child form?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jan 20th, 2004, 09:37 AM
#4
Sleep mode
Try this example I posted here . It's not MDI but the concept you'll apply is the same I beleive plus you need to reference the parent form to the current form you're working on . http://www.vbforums.com/showthread.p...hreadid=275354
-
Jan 20th, 2004, 02:12 PM
#5
Thread Starter
Frenzied Member
hey pirate, I was unable to open your example.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jan 20th, 2004, 02:44 PM
#6
Sleep mode
Originally posted by EyeTalion
hey pirate, I was unable to open your example.
It's winrar file (you need winrar to unpack it) and the project is VB.NET 2003 . What's the problem ?
-
Jan 20th, 2004, 03:16 PM
#7
Thread Starter
Frenzied Member
still trying to call a procedure from one child form to another in a mdi
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jan 22nd, 2004, 09:12 PM
#8
Addicted Member
Private sub btnOpen ..... Handles btnOpen.Click
Dim frmMain as Form=Me.MdiParent
Dim frm as Form
If frmMain.MdiCHildren.Length > 0 then
For Each frm in frmMain.MdiChildren
If frm.text="Data Form" then
Dim frmData as frmData = frm ' the form with the function on it
Exit For
End IF
Next
End If
frmData.yourfunctionname(sender,e) ' call your function
End Sub
Haven't tried it but it should work!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|