Which event to use to set initial form position?

  • Thread starter Thread starter Oenone
  • Start date Start date
O

Oenone

In VB6 I used to use the Load event of a Form to set its position on the
screen (based on wherever the user put the form the last time they used it).
This was ideal as it fired before the form became visible.

Since moving to VB.NET I'm finding that the Form is already displayed on
screen when the Load method executes. This means that I get a slight but
noticeable flicker when the form is first opened, as it moves from the
default position to the position I programmatically set it to.

Is there a better event that I can use for this than the Load event?

For info, I'm displaying the form as follows:

Dim myForm as New SomeForm
myForm.ShowDialog()

Many thanks,
 
Hi,

Use the new procedure instead.

Ken
-------------------
In VB6 I used to use the Load event of a Form to set its position on the
screen (based on wherever the user put the form the last time they used it).
This was ideal as it fired before the form became visible.

Since moving to VB.NET I'm finding that the Form is already displayed on
screen when the Load method executes. This means that I get a slight but
noticeable flicker when the form is first opened, as it moves from the
default position to the position I programmatically set it to.

Is there a better event that I can use for this than the Load event?

For info, I'm displaying the form as follows:

Dim myForm as New SomeForm
myForm.ShowDialog()

Many thanks,
 
Ken said:
Use the new procedure instead.

Ah yes, that works fine. I thought I'd tried that before and the window
hadn't been initialised (so it had no size or anything) but that must have
been something else I was trying.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top