Solved

visual basic x out of application

Posted on 2006-06-28
5
283 Views
Last Modified: 2013-11-25
I have an application that communicates with another machine.
I don't want people to be able to x out of the application.

I have code in the form unload that exits the sub, but the form still unloads.

How do I prevent this?
0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 17002941
You can disable the 'X' button in the upper right by setting the form's Control Box property to False.
As far as making it invisible, I am not sure if this is possible.

>I have code in the form unload that exits the sub, but the form still unloads.
This assumes that you have an means of causing the unload event to happen, such as your own Close button.

Hope this helps.
-Jim
0
 

Author Comment

by:jackjohnson44
ID: 17003204
I tried that, and I got an error.
"Function or interface marked as restricted, ..."

Are you sure controlbox should be set to false?
There is no intellitype for true or false here.
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 total points
ID: 17003345
that cannot be set on runtime


try this code:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   If UnloadMode = 0 Then
   'unload mode = 0 when the user presses x or presses alt+f4
      Cancel = 1
   End If
End Sub


0
 
LVL 20

Expert Comment

by:hes
ID: 17003686
If you want to disable the x button at runtime see here:

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

Expert Comment

by:justchat_1
ID: 17015696
Disabling the control box will prevent minimize or maximize from being shown but it is easy to exit the application.

Adding the cancel=1 will prevent the program from closing unless terminate process is used.

Are you also trying to prevent ALT + F4?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA Shell can't Find Word document 11 155
Problem to With line 4 86
transition to visual .net from vb6 5 80
What are MicroServices? 4 67
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question