Results 1 to 6 of 6

Thread: [RESOLVED] [2005] Tough Parent Question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Resolved [RESOLVED] [2005] Tough Parent Question

    At least it's a tough one for me:


    1) Open Form A
    2) In The Declarations Within Form A Declare frmB as New FormB
    3) In the Load Event of Form A State: frmB.Parent = Me (i.e. Form A).

    Question: Does this effectively make frmB a Control of Form A in the same sense that a TextBox on Form A is a control.

    If not, what exactly is happening. I need to know.

    Thanks

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: [2005] Tough Parent Question

    Not sure, but did that code actually run without crashing?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: [2005] Tough Parent Question

    Yup, runs just fine. I just need to know exactly what the relationship of FormA is To FormB. Because in this situation FormB behaves exactly like a control or FormA in the sense that any other control behaves.

    I think that's what occurs here but I really need to verify what's happening in the background. Does FormB (or frmB) in this example actually become a control of FormA?...

  4. #4
    Hyperactive Member
    Join Date
    May 2005
    Posts
    334

    Re: [2005] Tough Parent Question

    As far as I know, yes. But to verify try this:

    For each x as Control in me.Controls
    MessageBox.Show(x.Name)
    Next x

    If frmB shows up then it's one of FormA's controls.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: [2005] Tough Parent Question

    Yup! Thanks for the suggestion. I just learned alot. Probably should have known it anyway since that seems to be just one step away from a user control.

    So there ya go...

  6. #6
    Lively Member mowafy's Avatar
    Join Date
    Jul 2005
    Posts
    116

    Re: [RESOLVED] [2005] Tough Parent Question

    to add Formb to formA as controll
    do that
    1- set the toplevel to false for formb
    2- formA.controls.Add(formb)
    now formb will be like any textbox or command bottun on form
    A

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