Hai
I have solved this problem myself,
Before going to delete file from Temp folder i will open file in pdf viewer ,same like view file in pdf viewer and then close document,now we know definitely file is not open in pdf viewer,so no need to check file is open or not in the pdf viewer.
Call PDFxDoc.SetDevInfo("XXXX-XXXX-XXXX-XXXX-XXXX-XXXX", "XXXX$XXXX$XXXXXXX_XXXXXXX#")
PDFxDoc.OpenDocument(System.Windows.Forms.Application.StartupPath & "\sample.pdf")
CloseAllDocuments
Why i am ask need to check file is open or not in pdf viewer,in one Form user view pdf file and go to other Form for some other process ,so that time file is open in pdf viewer and user click logout button,sometimes user not open pdf file directly go to other Form and user click logout button.When user click logout button i will clear Temp folder in the StartupPath ,like
My.Computer.FileSystem.DeleteDirectory(System.Windows.Forms.Application.StartupPath + "\Temp", FileIO.DeleteDirectoryOption.DeleteAllContents)
So file is open in pdf viewer definitely it show error like "...used by other process....".
For this ,file is open or not by user ,when logout time i will open one temp pdf file from StartupPath (not form Temp folder which i am going to delete folder) to viewer and close it,so definitely those file open from Temp folder ,that file are released form viewer and can delete Temp Folder also.
Why i am use Temp folder in my application,user upload pdf file and i will store in sql server in the format of bytes,so if user need to open ,first i will get byte from sql server and convert as pdf file and save in Temp folder and view in pdf viewer.So each and every time if user see the pdf file ,Temp folder get lot of pdf files and space occupy more,so need to clear that files and get space.