Results 1 to 3 of 3

Thread: Refering to a control on an MDI Parent **RESOLVED**

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310

    Refering to a control on an MDI Parent **RESOLVED**

    I am trying to set some text in on a command button on an MDIParent form from an MDIChild form. How do I reference the control?

    I have made the scommand button public and the following code errors.

    VB Code:
    1. Me.MDIParent.Button1.text = "Test"

    So how do I go about doing this?
    Last edited by VBGuy; Oct 9th, 2003 at 05:35 AM.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    here's a quick example i made...
    In Form1 ( the Parent Form )
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim frmChild As New Form2()
    3.         frmChild.MdiParent = Me '/// tell the child that this is the parent form.
    4.         frmChild.Show()
    5.     End Sub
    6.  
    7.     Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
    8.         MessageBox.Show("test")
    9.     End Sub
    then in the child Form ( eg: Form2 )
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim frmMain As Form1 = Me.MdiParent '/// tell the parent that this is it's child form.
    3.         frmMain.MenuItem1.PerformClick()
    4.     End Sub
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    The Big D
    Posts
    310
    Thanks. Just what I was looking for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width