检查文件是否存在 [英] Check file if exist
问题描述
如何插入代码?信息,如果该文件是由其他程序打开                   &NBSP ;                        &NBSP ;                        &NBSP ;          
dim cse_name as string = sr_name +" output.cse"                                                                                                                   
如果file.exists = true,那么...                                                                                                                                                      
dim i1 as Integer = mesgbox(" ...,vbyesno) ENDIF                                                                                                                                                                           &NBSP ;                        &NBSP ;  
How can i insert a code for Info if the file is opened by an other program.
dim cse_name as string = sr_name + " output.cse"
if file.exists = true then ...
dim i1 as Integer =mesgbox("..., vbyesno) endif
sw1 = new IO.Streamwriter(cse_name) - >所以这里IOException问题,如果文件被打开。我怎样才能解决这个问题... 谢谢
sw1 = new IO.Streamwriter(cse_name) -> so here IOException problem if file is opened. How can i solve this problem... Thanks
推荐答案
你好lLikePP,
Hi lLikePP,
假设(如果文件未在其他任何地方打开):您打开已打开的文件。确保所有已打开的流正常关闭。您也可以使用此语法。
Assumption (if file was not opened anywhere else) : You open already opened one.Make sure that all your opened streams closed properly. You can use this syntax too.
Using writer As StreamWriter = New StreamWriter(file)
writer.Write("....")
//and so on
End Using
最好的问候,
Cherry
这篇关于检查文件是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!