Wednesday, August 15, 2007

Location of Form in VB.NET

I wanted to change the location of a form where it shows when it loads.
Just a simple thing, and i had done it many times, but i was trying

dim f as new MyForm
f.location = new point(-1000,-1000)
f.showdialog()

but it was not working. Couldnt figure out this a day before. After i came to office today, i was looking at some other things, and i found the solution.

just had to add a new statement before showing the form.

f.StartPosition = FormStartPosition.Manual

then it shows in the correct location.

Enjoy IT!