[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to control position of a modal window?

Posted on 2006-11-04
2
Medium Priority
?
357 Views
Last Modified: 2010-04-23

 I am developing a vb.net windows application. While showing a form as a modal dialog,  how I can control the position where the modal window will appear .  It is indeed good, if I can control the left and top of the window . Or the effect  of  "bottom of the parent" will be good enough.

   thanking you,
         Samson  
 
0
Comment
Question by:sgs1970
2 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 17872971
       Dim form As New Form1
        form.Location = Me.Poi New Point(100, 100)
        form.Width = 200
        form.Height = 200
        form.ShowDialog()

If you want to do this inside of child form itself, do this  in the form Load event handler. To find new form coordinates relatively to parent coordinates, use Control.PointToCScreen Method. For example, this line
form.Location = Me.PointToScreen(New Point(100, 100))
sets child form torm to position (100, 100) relatively to current form.
0
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 375 total points
ID: 17876028
but you have to set the form property

Form.StartPosition = FormStartPosition.Manual

for it to display at the position specified..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question