DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: aligning one form with another form's control

  1. #1
    kevin Guest

    aligning one form with another form's control


    i need to open a form under a control which is on another form. the top of
    the form to be opened needs to be aligned with the bottom of a textbox.

    please help

    kevin

  2. #2
    James Guest

    Re: aligning one form with another form's control


    kevin,

    To set the position of the form you need to use the form's location property.


    In this example I used 2 forms. In the first I made a class member called


    Dim frmX as New Form2()

    and then made a button to that shows the form and repositions:

    frmX.show()
    frmX.Location = New Point(Me.location.X + me.textbox1.location.x, _
    Me.Location.Y + Me.textbox1.location.Y + me.textbox.size.height)

    Logically, I thought this would work, but it didn't position the height correctly
    (put the top of the form at the top of the textbox). I fixed this by adding
    the textbox height a second time when I set the form's location:

    frmX.Location = New Point(Me.location.X + me.textbox1.location.x, _
    Me.Location.Y + Me.textbox1.location.Y + me.textbox.size.height
    _
    + me.textbox.size.height)

    This did it. I hope this is what you were looking for. I have found any other
    way to do it.

    James
    "kevin" <vb.@127.0.0.1> wrote:
    >
    >i need to open a form under a control which is on another form. the top

    of
    >the form to be opened needs to be aligned with the bottom of a textbox.
    >
    >please help
    >
    >kevin



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center