Results 1 to 9 of 9

Thread: [RESOLVED] form not locking?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    England
    Posts
    283

    Resolved [RESOLVED] form not locking?

    I want to set my form so no one can resize it and i have two problems:

    1. i set the locked property to true and the user is still able to move and resize the form??

    2. is there a way to only stop the user from resizing the form?? i want to allow moving of the form...

    Thanks

    GTJ

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: form not locking?

    Did you set FormBorderStyle to FixedSingle?

    If that's not working, you can also set the maximum and minimum size to the same value.

    (Note, in order to see the formborderstyle, you need to turn "Locked" off. The only thing that changes is your IDE's state, not the run state)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    England
    Posts
    283

    Re: form not locking?

    cheers that works perfectly, another question:

    What event is called when the user clicks on the X in the top right corner??

    (i want to give a "do u want to save changes" message box before the form closes, and allow the user to cancel the close)

  4. #4
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: form not locking?

    It calls a series of events, but the one that would best suite you is "Closing."

  5. #5
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: form not locking?

    System.Windows.Forms.Form.Closing?

    Sure there is...
    Quote Originally Posted by ObjectBrowser
    public event System.ComponentModel.CancelEventHandler Closing
    Member of System.Windows.Forms.Form

    Summary:
    Occurs when the form is closing.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    England
    Posts
    283

    Re: form not locking?

    yep sorry, i was looking for 'closing' after further searchin i found 'formclosing'.

    sorry bout that. :-|

    that has sorted my problem. Thanks.

    GTJ

  7. #7
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: [RESOLVED] form not locking?

    No worries
    Code:
    this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] form not locking?

    In .NET 1.x you use the Closing event. In .NET 2.0 you use FormClosing. Just another example of why it's importatnt to specify which version you're using when you post.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    England
    Posts
    283

    Re: [RESOLVED] form not locking?

    ok, cool will do in the future....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width