473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How To Disable a Forms Close Button

Does anyone know how I can disable a forms close button in C# without setting the control box value to false? I do not want the user to be able to close the application by clicking the x, but also do not want to take away the ability to minimize the form.

--
JOHN TYCE
Nov 16 '05 #1
2 24274


The easiest way would be to put in a handler for the form_closing event,
like this...

private void frmMyForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}

-James

"John Tyce" wrote:
Does anyone know how I can disable a forms close button in C# without setting the control box value to false? I do not want the user to be able to close the application by clicking the x, but also do not want to take away the ability to minimize the form.

--
JOHN TYCE

Nov 16 '05 #2
Thanks James.

--
JOHN TYCE
"James Divine" <James Di****@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...


The easiest way would be to put in a handler for the form_closing event,
like this...

private void frmMyForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}

-James

"John Tyce" wrote:
Does anyone know how I can disable a forms close button in C# without setting the control box value to false? I do not want the user to be able to
close the application by clicking the x, but also do not want to take away
the ability to minimize the form.
--
JOHN TYCE

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nick250 | last post by:
I have a simple app that I created for our Real Estate office using Access 2000 and it is working fine except for on thing. I need to keep the close button hidden from the users. No problem...
3
by: Saurabh Sharma | last post by:
Hi How do i disable windows close button in forms in C# Regards Saurabh
13
by: lightzizo | last post by:
All, How can I disable or remove the close button in the screen. thanks
9
by: cor-travel | last post by:
Hi Folk Is there a way to disable the close button for an application? Thank you - Nicolaas
1
by: Kikita | last post by:
Hi! I am working on a Internet Exam form that requires the students to finish their tests before closing the window, if closed by accident, the points they get will be added to the ones they will...
0
by: danasegarane | last post by:
Dear All, I am using VBA to develop programms.How can i disable the word X button ? Dana
1
by: jamesdel | last post by:
Hi I know how to disable the close button of the main access window. But i am not able to disable the maximum button. Can anyone help me in this regard. It certainly needs API function calling...
3
by: handumom | last post by:
is it possible to diseble the close button in pop up?what is the code in asp.net using vb
3
swarnalaxmi
by: swarnalaxmi | last post by:
In .net i created a datagridview to display a table... there i have to disable the close button. i searched in properties. i couldnot find. can you help? thanks in advance swarnalaxmi
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.