We help IT Professionals succeed at work.

New podcast episode! Our very own Community Manager, Rob Jurd, gives his insight on the value of an online community. Listen Now!

x

Repostion controls

71 Views
Last Modified: 2017-04-23
Hello,
How do I postion a form2 to open just below a control on form1.
When I resize the form1 or relocate it the form2 does not postion it correctly below the control on form1.

Cheers
Comment
Watch Question

AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
https://www.experts-exchange.com/questions/28983755/Open-form-in-the-top-right-hand-corner-of-screen.html
Just replace the top left values with the position you want to open the form.
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
I think you have asked a number of questions in the past about this.  The top, left, width and height parameters allow you to position and size forms and controls in relation to other forms and controls.

Author

Commented:
Andy,
I know, but the previous questions were regarding the location when form1 is fixed. In this case i am moving the mainform i.e form1 is repostioned and can't get form2 to open in the right place.

Cheers
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
Just to be absolutely clear.
You are talking about opening form2 in a certain position related to form1 (or a control on form1).  You are not talking about moving form1 whilst form2 is already opened.

>>but the previous questions were regarding the location when form1 is fixed
Exactly what do you mean by fixed.

Author

Commented:
Need to open the form2 below a control on form1 , I can relocate the form1 but still the form2 should open below the same control on form1.

Cheers
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
Can you show your current code.  Something must be wrong with that.

Author

Commented:
I am trying:
  FRM.TopLevel = False
   Me.Panel1.Controls.Add(FRM)
   FRM.TopLevel = False
   Me.Panel1.Controls.Add(FRM)
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
?
That has nothing to do with positioning a form.  Have a look at the link (to a previous question of yours) about setting the position of a form.
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
That code has nothing to do with positioning a form.  It looks rather more you have created a panel in design mode, positioned that panel on the form where you want and then created another form inside the panel.
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
ps.  If you wanted a subform embedded in a form why not ask how to do that - it would have saved both of us time and effort.

Author

Commented:
Andy,
I thought of the idea later to have a panel, istead of position the subform under a control.
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
  • OK, but you could do the job just as well with top and left - which you didn't use according to your earlier code snippet
  • The first time you talk about it being a subform (not a form which positions correctly but when you move your main form it opens somewhere else) embedded in your main form is in your 'answer'

Please ask about what you want.  You will get a better response.

Author

Commented:
Found solution and have posted the solution.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.