473,387 Members | 3,781 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,387 software developers and data experts.

Disable Close Button

137 100+
hi all,
can the close button on the title bar of the form be disabled so that the user can't close the form.
thanx
Apr 13 '07 #1
4 3466
Killer42
8,435 Expert 8TB
hi all,
can the close button on the title bar of the form be disabled so that the user can't close the form.
Yes. If it's VB6, you set the form's ControlBox property to False.

In Vb.Net, I have no idea.
Apr 13 '07 #2
ansumansahu
149 100+
hi all,
can the close button on the title bar of the form be disabled so that the user can't close the form.
thanx
You can check this link and see if it helps for disabling the close button.

http://www.developerfusion.co.uk/show/72/8/

-ansuman sahu
Apr 13 '07 #3
ansumansahu
149 100+
hi all,
can the close button on the title bar of the form be disabled so that the user can't close the form.
thanx
Also this is another link see if it helps you out

http://www.freevbcode.com/ShowCode.Asp?ID=2448

-ansuman sahu
Apr 13 '07 #4
hi all,
can the close button on the title bar of the form be disabled so that the user can't close the form.
thanx
yes you Can do it in Two way.1) the Killer42 already told you & another
by Calling Two API
I Just Giving you the sample Code how to implement it. try it
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
  3.                          ByVal bRevert As Long) As Long
  4. Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
  5.                          ByVal nPosition As Long, ByVal wFlags As Long) As Long
  6.  
  7. Private Sub Form_Load()
  8.    RemoveCloseMenuItem (Me.hwnd) ' this is a user define pocedure
  9. end sub
  10. 'the actual procedure
  11. Public Sub RemoveCloseMenuItem(ByVal hwnd As Long)
  12.     Const SC_CLOSE = &HF060
  13.     'Const SC_MINIMIZE = &HF060
  14.     Const MF_BYCOMMAND = 0
  15.     'Const MF_BYCOMMAND1 = 1
  16.     Dim hMenu As Long
  17.     'Dim hMenu1 As Long
  18.     ' get the system menu's handle
  19.     hMenu = GetSystemMenu(hwnd, 0)
  20.     'hMenu1 = GetSystemMenu(hwnd, 1)
  21.     ' remove the Close item
  22.     RemoveMenu hMenu, SC_CLOSE, MF_BYCOMMAND
  23.     'RemoveMenu hMenu1, SC_MINIMIZE, MF_BYCOMMAND1
  24. End Sub
  25.  
Try it.I am also waiting for your response.
try it also in vb.net (I am no try it yet).Good luck.
Apr 13 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JCharlie | last post by:
hi all. I´ve a problem with x button on internet explorer. Some users fills an informative form, they push x button and i don´t save the information. How can i disable the x button on internet...
3
by: Saurabh Sharma | last post by:
Hi How do i disable windows close button in forms in C# Regards Saurabh
6
by: Raghu Raman | last post by:
Hi, we are doing an in house project in c#.net(asp.net).We wanted to close our application when ever the user presses the SIGNOUT button. Even though we programtically disconnects them from the...
3
by: Paul | last post by:
Hi, just wondering if there is a way to disable the back button of the browser as I have a logoff page and would like to not allow the back operation? Guessing there may be a way to do it through...
24
by: Agnes | last post by:
I need to disable the exit button in the form . However, the min. and max. button need to keep it How ? Thanks a lot From Agnes
2
by: PamelaDV | last post by:
I am wondering if there is a way to disable the "X" used to close the Access application window? I know how to disable it for individual forms, but I would like to disable it for the application...
4
by: mhifd009 | last post by:
I have disabled a close button in the property section of a form (FRM1), as i open the form the close button has gone (i have programmed close button), but as i close the form, the form that opened...
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...
1
by: kenzs | last post by:
Hi! how to disable close(x) button in web form, i want only close button,don't disable in maximize button ,minimize button
1
by: jagan1976 | last post by:
I want to disable close button for each report and it would apply to all users. Is there any script or method available which will disable close button for all reports at once without using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.