Cancel Error Vb6
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn vb6 throw error more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags automation error in vb6 Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you,
Overflow Error In Vb6
helping each other. Join them; it only takes a minute: Sign up Detecting Cancel button in CommonDialog control up vote 1 down vote favorite In VB6, if I press the Cancel button on an Open File dialog
3705 Error In Vb6
box, my filename is still added into my listbox. For example: Private Sub btnImportImage_Click() DailogOpenFile.ShowOpen If Trim$(txtEmailAttachment.Text) = "" Then txtEmailAttachment.Text = DailogOpenFile.FileName Else txtEmailAttachment.Text = txtEmailAttachment.Text & ";" & DailogOpenFile.FileName End If End Sub vb6 share|improve this question edited Jul 29 '15 at 13:13 Bond 12.1k61441 asked Jul 29 '15 at 9:39 Koyubi Choatky 84 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted It looks like you're using 3704 error in vb6 the CommonDialog control? If so, you need to set the CancelError property to True and then test for an error afterwards. For example: Private Sub btnImportImage_Click() DailogOpenFile.CancelError = True On Error Resume Next DailogOpenFile.ShowOpen If Err.Number = &H7FF3 Then ' Cancel clicked Else End If ... End Sub Of course, you can also jump to an error handler: Private Sub btnImportImage_Click() DailogOpenFile.CancelError = True On Error GoTo MyErrorHandler DailogOpenFile.ShowOpen ... MyErrorHandler: ' Cancel was clicked or some other error occurred End Sub share|improve this answer answered Jul 29 '15 at 13:11 Bond 12.1k61441 Thank you for your advice. @Bond :D –Koyubi Choatky Aug 3 '15 at 2:36 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged vb6 or ask your own question. asked 1 year ago viewed 1143 times active 1 year ago Related 5What's so bad about using button captions as variables in VB6?0How to set the InitDir property of a CommonDialog control to My Computer3InputBox Cancel16Can't move controls in VB63Detecting Cancel being pressed in
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student
Runtime Error In Vb6
Partners ISV Startups TechRewards Events Community Magazine Forums Blogs runtime error 5 vb6 Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The runtime error 53 vb6 content you requested has been removed. You’ll be auto redirected in 1 second. Language Reference Properties C C CancelError Property CancelError Property CancelError http://stackoverflow.com/questions/31696676/detecting-cancel-button-in-commondialog-control Property CacheSize Property Calendar Property CalendarBackColor, CalendarForeColor Properties CalendarTitleBackColor, CalendarTitleForeColor Properties CalendarTrailingForeColor Property CallSyntax Property Cancel Property CancelError Property CanEject Property (Multimedia MCI Control) CanGetFocus Property CanGrow Property CanPaste Property CanPlay Property (Multimedia MCI Control) CanRecord Property (Multimedia MCI Control) CanStep Property (Multimedia MCI Control) Cap Property https://msdn.microsoft.com/en-us/library/aa226974(v=vs.60).aspx Caption Property Caption Property (ActiveX Controls) Caption Property (Band Object) Caption Property (DataGrid Control, Column Object) Caption Property (DEDesigner Extensibility) Caption Property (Tab Object) Caption Property (VBA Add-In Object Model) CaptionStyle Property Category Property CategoryScale Property CausesValidation Property CDHolding Property CellAlignment Property CellBackColor, CellForeColor Properties CellFontBold Property CellFontItalic Property CellFontName Property CellFontSize Property CellFontStrikeThrough Property CellFontUnderline Property CellFontWidth Property CellHeight, CellLeft, CellTop, CellWidth Properties (MSHFlexGrid) CellHeight, CellWidth Properties (PictureClip Control) CellPicture Property CellPictureAlignment Property CellTextStyle Property CellType Property (MSHFlexGrid) Center Property Changed Property Charset Property Chart3d Property ChartData Property ChartType Property CheckBox Property Checkboxes Property Checked Property Checked Property (Windows Common Controls) Child Property (Band Object) Child Property (Node Object) ChildComparison Property ChildCondition Property Children Property ChunkRequired Property (Remote Data) Class Property Class Property (OLEObject Object) ClassName Property ClientHeight, ClientWidth, ClientLeft, ClientTop Properties Clip Property (MSHFlexGrid) Clip Property (
I click on the "Cancel" button on a common dialog box in my application, the file operation (open, save, etc.) is still performed if there is a file name in the File Name field. How http://computer-programming-forum.com/16-visual-basic/4d41e5bf820d04cd.htm can I make the Cancel button actually cancel the operation? Thanks. Lamar Hawkins Wed, 18 Jun 1902 08:00:00 GMT Doug Ros#2 / 4 Cancel Button on Common Dialog Box Set the CancelError property of the common dialog control to True and provide an error handler for cdlCancel that does nothing. Quote:> ********************************************************************** > When I click on the "Cancel" button on a common dialog box in my > application, error in the file operation (open, save, etc.) is still > performed if there is a file name in the File Name field. How can > I make the Cancel button actually cancel the operation? Thanks. > Lamar Hawkins Wed, 18 Jun 1902 08:00:00 GMT psmithp..#3 / 4 Cancel Button on Common Dialog Box This is what worked for me; I hope it helps: '============CommonDialog1===================================== CommonDialog1.Filter = "MSAccess (*.mdb)|*.mdb" 'Shows error in vb6 only .mdb files. CommonDialog1.ShowOpen 'Opens CommonDialog1 Dim msgAnswer If CommonDialog1.CancelError = False Then msgAnswer = MsgBox("Do you wish to quit?", vbYesNo, "Continue?") If msgAnswer = vbYes Then Exit Sub End If End If Quote:> ********************************************************************** > When I click on the "Cancel" button on a common dialog box in my > application, the file operation (open, save, etc.) is still > performed if there is a file name in the File Name field. How can > I make the Cancel button actually cancel the operation? Thanks. > Lamar Hawkins Sent via Deja.com http://www.deja.com/ Before you buy. Wed, 18 Jun 1902 08:00:00 GMT Phillip War#4 / 4 Cancel Button on Common Dialog Box Lamar, The CommonDialog Control doesn't actually do the Save (or whatever), so clicking the Cancel button can only return an indication that the Cancel button was pressed to your code, which has to handle it. Checkout the .CancelError property, then try adding code something like this ... On Error R