| | |
Apply code to 'x' button on form
Thread Solved |
http://www.vb6.us/files/Image/Hello-...al-screen5.jpg
Look at this image
You see where the two drop down boxes say Command1 and Click?
Change that to say form1, and the second one to say (i think its either Terminate or onClose, will have a lightning bolt symbol next to it)
That will create a code block. In there you can type whatever you want to happen when they try to close the form
Look at this image
You see where the two drop down boxes say Command1 and Click?
Change that to say form1, and the second one to say (i think its either Terminate or onClose, will have a lightning bolt symbol next to it)
That will create a code block. In there you can type whatever you want to happen when they try to close the form
If i am helpful, please give me reputation points.
•
•
•
•
@koolsid
Does this code just disable the 'x' button?
Thats the conclusion im drawing from your image there.

The API is very simple... All you need to do is copy and paste the code in the general declaration of the area....
Edit: Attaching a project sample for you
Last edited by koolsid; Mar 29th, 2009 at 3:04 pm.
A good excercise for the Heart is to bend down and help another up...
Please Mark your Thread "Solved", if the query is solved...
==>If a post has helped you then Please Rate it!
Please Mark your Thread "Solved", if the query is solved...
==>If a post has helped you then Please Rate it!
•
•
•
•
Nah, unfortunately that didnt work hkdani. But thanks for the post
What I like about the method that Microsoft recommends is it's simplicity. That's why they made Visual Basic, because they knew that programs could be written faster and programmers could be more productive, if they were provided a simple way to perform a task such as the task you describe.
From what I've read and studied from the established authors and programmers, they always recommend the KISS method: Keep it Simple Stupid.
Yes, it's true that you can use API's. And it looks quite impressive. But in the end, in the real world it's all about achieving a desired end within a certain time frame.
If you can't achieve that end with the tools that VB6 provides, then VB6 has the flexibility of being able to call the Windows APIs from the Platform Software Developer Kit (PSDK). But as a general rule, use the tools that VB6 provides and only venture into APIs if VB6 doesn't provide the means to accomplish your end.
When it comes right down to where the rubber meets the road the end user will never see your code. He only sees your program. The programmer should not try to impress someone with his knowledge of Windows APIs, the end user probably doesn't have a clue as to what an API is.
Knowledge tends to puff people up. But a truly great programmer uses his knowledge to meet the needs of his client not to enhance his ego.
•
•
•
•
@Koolsid
I actually want the 'x' enabled. But I want to apply code to it.
@Jbennet
Thanks, that worked. Just one problem. Whether Yes or NO is chosen. The program still closes. Any reason why?

Is this what you want?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormControlMenu Then Ret = MsgBox("Do You want to Exit?", vbOKCancel) '~~> If user decides against it... If Ret = vbCancel Then Cancel = 1 End If End Sub
A good excercise for the Heart is to bend down and help another up...
Please Mark your Thread "Solved", if the query is solved...
==>If a post has helped you then Please Rate it!
Please Mark your Thread "Solved", if the query is solved...
==>If a post has helped you then Please Rate it!
KSS and Sidz
You have both my thanks!
@Sidz, the zip file you gave me actually helped with another situation I had. lol One less thread to start up. Because I want my icons to show. So thank you.
@KSS, the zip you gave was EXACTLY what I was looking for. Thank again.
Now that I think of it...That final snippet you provided Sidz was the same thing in the zip KSS gave. Thanks again.
I do appreciate it.
Thread Solved!
-Russell aka Rabbit
You have both my thanks!
@Sidz, the zip file you gave me actually helped with another situation I had. lol One less thread to start up. Because I want my icons to show. So thank you.
@KSS, the zip you gave was EXACTLY what I was looking for. Thank again.
Now that I think of it...That final snippet you provided Sidz was the same thing in the zip KSS gave. Thanks again.
I do appreciate it.
Thread Solved!
-Russell aka Rabbit
![]() |
Similar Threads
- Help! PHP form mailer not working. (PHP)
- Please help with passing data from one form to another form (VB.NET)
- Convert SINGLE-file upload into multiple files with foreach loop, cant figure out (PHP)
- Redesign an input type="file" (JavaScript / DHTML / AJAX)
- Variable scope problem (C++)
- Word Macros (Computer Science)
- .net validation/javascript conflict (ASP.NET)
- Go to a certain page when button is pressed and do it securely (ASP.NET)
- Storing dynamic form values in Arrays for display & insert (PHP)
- Access Sub switchboard password protection (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: how to use the keypress function is visual basic 6
- Next Thread: Searching for records contained in access from VB
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






