| |

VerySource

 Forgot password?
 Register
Search
View: 684|Reply: 3

Dialog form

[Copy link]

4

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-29 20:20:01
| Show all posts |Read mode
How can I determine whether the CommonDialog has been pressed or cancelled in VB?
Reply

Use magic Report

0

Threads

46

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-3-4 19:00:01
| Show all posts
MSSOAPLib
Reply

Use magic Report

0

Threads

46

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-3-5 06:30:01
| Show all posts
Sorry, just posted it wrong.


CancelError = true
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-5 15:15:01
| Show all posts
'Purpose:
  '' Author: Wu Wenzhi
  'Date: 2001-11-13
  'Description: To try this example, add a CommonDialog and a button to the form
  'Then paste the following code in the code form
  'Good luck!
    
  Option Explicit
    
  Private Sub Command1_Click ()
          On Error GoTo ErrHandle
            
          With CommonDialog1
                  'Error triggered when user cancels
                  .CancelError = True
                  .Filter = "Text file | * .txt"
                  .ShowOpen
                  MsgBox .FileName
          End With
            
          Exit Sub
            
  'Error handling
  ErrHandle:
          Select Case Err.Number
          Case 32755
                  MsgBox "User cancelled", vbInformation
          Case Else
                  MsgBox Err.Description, vbCritical, Err.Number
          End Select
  End Sub
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list