Help with prevenyt users from draging Windows Form

Hi,

How do you prevent users from draging a Winfows Form using VB.NET, I tried the lock property bu it doesn't work?

Thnaks,

Victor
vcharlesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Snarf0001Commented:
What do you mean, you want to stop them from being able to move the form?
If so, can I ask why?  That would irritate most users to no end.

If that is what you're after, you'd have to either:
1) Set the FormBorderStyle to None, which removes all the minimize / maximize / close buttons
2) Set a lot of custom code to stop the movement if you need the win frame to still be active.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vcharlesAuthor Commented:
Hi,

Form2 is centerd on top of Form1, would like to prevent users from moving Form2, best approach would be a Parent and child Form combination, but this approach should also work.

Victor
0
Jacques Bourgeois (James Burger)PresidentCommented:
Form2 could be created as a UserControl.

You add a UserControl to your project, copy the controls that you have on Form2 on that UserControl, then copy the code, that might need a few adjustments because a UserControl does not have all the events of a Form.

Once compiled, the UserControl will show in the ToolBox. You can put it on Form1 as you do with any other control. Simply play with its visible property to show it or hide it. It will stay in place, even if the user moves Form1.
0
vcharlesAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.