PC Review


Reply
Thread Tools Rate Thread

How do i refer to MasterMDI form

 
 
Paul
Guest
Posts: n/a
 
      4th Sep 2003
I have a MDI container form "frmParent". On that form there is a tabstrip
control with 2 pages. On one of those pages there is a textbox and a
button.

When the user clicks on the button a child form is opened inside the
container form "frmChild" which displays a datagrid. The WHERE clause in
the select statement which is bound to the grid comes from the textbox on
the Parent form.

How do I refer to this textbox control ?

Thanks in Advance



 
Reply With Quote
 
 
 
 
Bob
Guest
Posts: n/a
 
      4th Sep 2003
The child form should return your parent form in its .MdiParent property. You
then need to cast this returned value as your parent form, so if your MdiParent
class is named 'MyParent' and the textbox is named 'SomeTextBox', you would
access the textbox as such from the child form:

Private Function GetParentTextBox() As TextBox
Return DirectCast(Me.MdiParent, MyParent).SomeTextBox
End Function

That being said, this is poor design and it's important for you to understand
why. In this case, briefly, it is not well to have direct dependencies between
forms, especially between a child and a parent, because you lose both
reusability and robustness.

I recommend you read some books on convention and methodology. One I have read
and liked:

Application Architecture for .NET: Designing Applications and Services
Microsoft
ISBN 0-7356-1837-2

HTH,
Bob

"Paul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a MDI container form "frmParent". On that form there is a tabstrip
> control with 2 pages. On one of those pages there is a textbox and a
> button.
>
> When the user clicks on the button a child form is opened inside the
> container form "frmChild" which displays a datagrid. The WHERE clause in
> the select statement which is bound to the grid comes from the textbox on
> the Parent form.
>
> How do I refer to this textbox control ?
>
> Thanks in Advance
>
>
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
use the Form property to refer to a form associated with a subform Ayaz Hoda Microsoft Access 6 19th May 2008 10:43 AM
Refer to a subform on a tab on a form Bill (Unique as my name) Microsoft Access Forms 2 3rd Jul 2006 02:21 AM
How do I refer to result in order form, from customer form? =?Utf-8?B?TWVoZGk=?= Microsoft Access Form Coding 1 11th Aug 2005 05:15 AM
How do I refer to Startup Form Controls from another form. JAPSTER Microsoft VB .NET 3 18th Jan 2005 12:10 PM
Refer to Sub-form (Controls) from Main Form , Possible ? Dave Elliott Microsoft Access Forms 2 1st Sep 2003 11:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:22 PM.