Quantcast
Viewing all articles
Browse latest Browse all 27412

VS 2010 Problem with auto click OK buttons on error messages

A part of my application deletes some folders on a particular directory.

Code:

                          Try
                                My.Computer.FileSystem.DeleteDirectory(subdirDest, _
                                                FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
                                strDeletedFolderd = strDeletedFolderd + subdirDest + vbNewLine
                                                               
                            Catch ex As Exception

                                strErrors = strErrors + subdirDest + vbNewLine
                                strErrors = strErrors + "Reason:  " + ex.ToString + vbNewLine + vbNewLine

                            End Try

If a folder is deleted, everything is OK. However, sometimes it is not deleted for some reason (e.g. a file of the folder is open) and an error message is generated.

Attachment 94729

I would like my application to catch any error messages and if they appear, OK button should be clicked automatically. I have tried to insert SendKeys.SendWait("{ENTER}") after Catch ex As Exception line, but it did not help.

I would be grateful if anybody could help me.
Attached Images
Image may be NSFW.
Clik here to view.
 

Viewing all articles
Browse latest Browse all 27412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>