Solved

visual basic x out of application

Posted on 2006-06-28
5
282 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 connector to mongodb 2 139
Help me. 3 69
Automatically generate a pdf file from an excel file and email out everyday 2 67
MS SQL Update query with connected table data 3 59
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

763 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