Friends, In Form properties, There are Maximize Box and Minimize Box.If we make them false, those prperties will be disabled.Likewise there is a Close Box at the right top corner of the form.How can we disable this? Is there any way at design time to disable this? If not,Can we disable it through code?

Recommended Answers

All 3 Replies

You could set the FromBorderStyle property to None.

In the FormClosing you could always do

e.Cancel = True

But you should also give the user some other way to exit. For example, if the user selects Exit from a menu you could set a class flag as in

Private ReallyExit As Boolean = False

Private Sub Form1_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
    e.Cancel = ReallyExit
End Sub

Just make sure that somewhere in your code you do

ReallyExit = True

Thank you all ..Making Formboarder style to None is easier and convenient..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.