setting child form's top = ....


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: setting child form's top = ....

  1. #1
    kevin Guest

    setting child form's top = ....


    i am trying to make a child form open up at a specific position on the screen.
    i am using the following code:

    dim form1 and new form1()
    me.top = form1.button1.top

    thought it would be as easy as that...but it doesn't work...would appreciate
    any help anyone has to offer.

    kevin



  2. #2
    Kunle Odutola Guest

    Re: setting child form's top = ....


    "kevin" <kswiber@hotmail.com> wrote in message news:3c9f98ae$1@10.1.10.29...
    >
    > i am trying to make a child form open up at a specific position on the

    screen.
    > i am using the following code:
    >
    > dim form1 and new form1()
    > me.top = form1.button1.top
    >
    > thought it would be as easy as that...but it doesn't work...would

    appreciate
    > any help anyone has to offer


    See SetDesktopLocation and StartPosition members of the Form class.

    Kunle



  3. #3
    Rob Teixeira Guest

    Re: setting child form's top = ....


    > dim form1 and new form1()
    > me.top = form1.button1.top


    Your problem is that the button's Left/Top etc. are relative to the form
    it's in (its parent), while the second form's coordinates are relative to
    the screen.

    You need to translate the button coords to screen location. To do that, get
    the button's location, and then call it's parent form's PointToScreen method
    to translate those coords to screen location. You can then use that to position
    the second form.

    -Rob


  4. #4
    kevin Guest

    Re: setting child form's top = ....


    rob:

    i am closer by using what you told me.

    i am a customer form that displays customers information. while in edit
    mode i have a button that opens a form with a listbox on it displaying necessary
    information. the button is next to a txtbox and resembles a combobox. i
    need the newly opened form to be displayed underneathe the txtbox that corresponds
    with the button

    thanks for any help you have to offer

    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