Click here to Skip to main content
15,905,679 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
Jats_4ru18-Apr-08 3:14
Jats_4ru18-Apr-08 3:14 
QuestionHashing password, HOW ? Pin
masoodp66617-Apr-08 22:49
masoodp66617-Apr-08 22:49 
AnswerRe: Hashing password, HOW ? Pin
Guffa18-Apr-08 0:42
Guffa18-Apr-08 0:42 
GeneralRe: Hashing password, HOW ? [modified] Pin
Rob Smiley18-Apr-08 5:51
Rob Smiley18-Apr-08 5:51 
GeneralRe: Hashing password, HOW ? Pin
masoodp66618-Apr-08 8:02
masoodp66618-Apr-08 8:02 
GeneralRe: Hashing password, HOW ? Pin
Guffa18-Apr-08 12:06
Guffa18-Apr-08 12:06 
GeneralRe: Hashing password, HOW ? Pin
Rob Smiley18-Apr-08 23:33
Rob Smiley18-Apr-08 23:33 
QuestionString or binary data would be truncated. The statement has been terminated Pin
zaimah17-Apr-08 18:11
zaimah17-Apr-08 18:11 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
Christian Graus17-Apr-08 19:46
protectorChristian Graus17-Apr-08 19:46 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
darkelv17-Apr-08 19:48
darkelv17-Apr-08 19:48 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
zaimah17-Apr-08 20:59
zaimah17-Apr-08 20:59 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
Ashfield17-Apr-08 21:15
Ashfield17-Apr-08 21:15 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
Christian Graus17-Apr-08 21:47
protectorChristian Graus17-Apr-08 21:47 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
zaimah17-Apr-08 23:28
zaimah17-Apr-08 23:28 
GeneralVS 2005 VB.NET: Global Module failing to initializ Pin
kindman_nb17-Apr-08 8:04
kindman_nb17-Apr-08 8:04 
GeneralRe: VS 2005 VB.NET: Global Module failing to initializ Pin
Dave Kreskowiak17-Apr-08 8:18
mveDave Kreskowiak17-Apr-08 8:18 
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 
hy everyone!

i know my question is of topic but maybe someone has an idea why this problem occures:

I do have a macro which parses files. when finished i want to move the file to a different directory (either the one, where well parsed files are put into or in the one where bad parsed files are put into).

therefor i have to use the movefile and deletefile.

because my macro first checks, if there is already and (old) copy of the file, if so then delete it and replace it with the new one. if not then i simply copy it to the destination file.

therefor i programmed

Function DeleteandMoveFile(ByVal dest As String, ByVal source As String, ByVal filename As String) As Boolean
Dim filesys As Object
DeleteandMoveFile = TRUE 'just a dummy operation

  Set filesys = CreateObject("Scripting.FileSystemObject")

  'Check if File exists in destinationpath then delete it
  If filesys.FileExists(dest & filename) Then
    If filesys.DeleteFile(dest & filename)then
      'MsgBox "file deleted successfully
    Else
      'MsgBox "couldn't delete file"
      Application.WriteEventLog "macro", "couldn't delete file",5
    End If		
  End If

  ' Check if file exists in source path then move it
  If filesys.FileExists(source & filename) Then 
    If filesys.MoveFile(source & filename, dest)
      'MsgBox "file moved"
    Else		
      Application.WriteEventLog "macro", "file couldn't be moved!",5
    End If
  Else
    Application.WriteEventLog "macro", "file does not exist!" ,5
  End If
  Set filesys = Nothing
End Function


Looks fine, doesn't it? Well the macro does exactly what I want it to, but it also writes the error messages into eventlog. Meaning it does the if statements but the steps directly to the error message and continues operating. As if I also added the error message to the if statement.

Does anyone of you have an idea? Does Windows somehow have a handle or something on the file which causes an exception when moving or deleting??

If it doesn't work, then it would be "ok" for me, but remember: The macro does what I want it to but throws the error messages as well (seems to be in if and else during the same loop!).

Maybe anyone of you could help me please!

thanks.
Stephan.
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
Dave Kreskowiak17-Apr-08 6:51
mveDave Kreskowiak17-Apr-08 6:51 
GeneralRe: OT: DeleteFile and MoveFile in VBS Pin
stephan_00717-Apr-08 8:24
stephan_00717-Apr-08 8:24 

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.