Click here to Skip to main content
15,887,355 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VS 2005 VB.NET: Global Module failing to initializ Pin
kindman_nb17-Apr-08 13:48
kindman_nb17-Apr-08 13:48 
GeneralRe: VS 2005 VB.NET: Global Module failing to initializ Pin
Dave Kreskowiak18-Apr-08 3:57
mveDave Kreskowiak18-Apr-08 3:57 
GeneralCompare values in DataRow field with its original value Pin
Steven J Jowett17-Apr-08 6:28
Steven J Jowett17-Apr-08 6:28 
GeneralRe: Compare values in DataRow field with its original value Pin
Dave Kreskowiak17-Apr-08 8:15
mveDave Kreskowiak17-Apr-08 8:15 
GeneralRe: Compare values in DataRow field with its original value Pin
Steven J Jowett17-Apr-08 11:19
Steven J Jowett17-Apr-08 11:19 
GeneralRe: Compare values in DataRow field with its original value Pin
Dave Kreskowiak18-Apr-08 1:32
mveDave Kreskowiak18-Apr-08 1:32 
GeneralOT: DeleteFile and MoveFile in VBS Pin
stephan_00717-Apr-08 5:22
stephan_00717-Apr-08 5:22 
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
Dave Kreskowiak17-Apr-08 6:51
mveDave Kreskowiak17-Apr-08 6:51 
Simpler idea. First, check if the source file exists. Then, if it does, just copy the file from the source to the destination, overwriting the destination if the same filename exists. That way, you don't have to care if the destination exists, just to delete the thing anyway.

Now, on to your actual problem. Since MoveFile and DeleteFile do NOT return any kind of value, I think your actually checking the FSO object instance being Nothing, which will return False, and hence, log an error message.

To prevent weird problems like this, I usually don't call methods on objects inside conditional expressions. I usually assign return values to vairables and use those variables in the expressions instead. This allows for additional checking of return values, such as valid objects and values within expected ranges.


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
stephan_00717-Apr-08 8:24
stephan_00717-Apr-08 8:24 
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
Dave Kreskowiak17-Apr-08 8:37
mveDave Kreskowiak17-Apr-08 8:37 
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
stephan_00717-Apr-08 8:42
stephan_00717-Apr-08 8:42 
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
Ashfield17-Apr-08 9:00
Ashfield17-Apr-08 9:00 
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
stephan_00717-Apr-08 9:31
stephan_00717-Apr-08 9:31 
General"Can not create ActiveX Component" Pin
Harold_Wishes17-Apr-08 5:07
Harold_Wishes17-Apr-08 5:07 
GeneralRe: "Can not create ActiveX Component" Pin
Dave Kreskowiak17-Apr-08 5:11
mveDave Kreskowiak17-Apr-08 5:11 
GeneralRe: "Can not create ActiveX Component" Pin
Harold_Wishes17-Apr-08 5:22
Harold_Wishes17-Apr-08 5:22 
GeneralDatagrid Colour Based on the Records in the table Pin
Vimalsoft(Pty) Ltd17-Apr-08 3:29
professionalVimalsoft(Pty) Ltd17-Apr-08 3:29 
GeneralRe: Datagrid Colour Based on the Records in the table Pin
Dave Kreskowiak17-Apr-08 3:42
mveDave Kreskowiak17-Apr-08 3:42 
GeneralDatabase connection using Vb.net 2003 and MySQL 4.1 Pin
magesh2117-Apr-08 2:27
magesh2117-Apr-08 2:27 
GeneralRe: Database connection using Vb.net 2003 and MySQL 4.1 Pin
Dave Kreskowiak17-Apr-08 3:34
mveDave Kreskowiak17-Apr-08 3:34 
Generalcombo box invalid property array index Pin
kankeyan17-Apr-08 0:20
kankeyan17-Apr-08 0:20 
GeneralRe: combo box invalid property array index Pin
Luc Pattyn17-Apr-08 0:37
sitebuilderLuc Pattyn17-Apr-08 0:37 
GeneralRe: combo box invalid property array index Pin
kankeyan17-Apr-08 2:18
kankeyan17-Apr-08 2:18 
GeneralRe: combo box invalid property array index Pin
Luc Pattyn17-Apr-08 2:46
sitebuilderLuc Pattyn17-Apr-08 2:46 
QuestionSQL Timeout repeating a query Pin
Paul DAmbra16-Apr-08 22:51
Paul DAmbra16-Apr-08 22:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.