Creating a VB.NET form that users cannot move
Takeaway: In Visual Basic .NET, there are two simple options for making sure that a form you create cannot be moved by users. Irina Medvinskaya discusses both options in this tip.
There are situations that require developers to prohibit users for moving a particular form. This may be required whenever you feel that the users need to fill out some data before proceeding or moving the form to work with some other application form.
In VB.NET, there are two simple options for making sure that the form can't be moved. In this tip, I explore both options, which are creating a borderless form and creating a form with borders.
Borderless form
You can make a borderless form by setting its FormBorderStyle property to None. This method works because borderless forms can't be moved. However, this option is somewhat limiting since utilizing this method results in a form that doesn't have any borders. The form would look like Figure 1.
Form with borders
If you want to implement a form that has borders but cannot be moved by users, the alternative is to set the ControlBox, MinimizeBox, and MaximizeBox properties to False. Then, you would set the Text property to an empty string. The resulting form will have a raised border but will not be moveable. The form would look like Figure 2.
Miss a tip?
Check out the Visual Basic archive, and catch up on the most recent editions of Irina Medvinskaya's column.
Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!
White Papers, Webcasts, and Downloads
- Why Isn't Server Virtualization Saving Us More? A Few Small Changes May Dramatically Increase Your Efficiency VMware Ever wonder why your company isn't saving more from its server virtualization? Making a few small changes could dramatically increase your efficiency. Download Now
- The Impact of Virtualization Software on Operating Environments VMware Today's use of virtualization technology allows IT professionals to ... Download Now
- VMware Infrastructure: A Guide to Bottom-Line Benefits VMware Frustrated by the high cost of maintaining or building ever-larger data centers? Get the facts you need to formulate your Virtualization Action Plan. Download Now
- Five Steps to Determine When to Virtualize YourServers VMware Thinking of virtualizing the servers at your company? Use this step-by-step guide to determine when's the best time to make your big move. Download Now
- The Scalable Enterprise: VMware ESX Server on the Dell PowerEdge 6650 Dell This paper introduces the server virtualization software, VMware ESX ... Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET


