Click here to Skip to main content
15,918,889 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalget string array length Pin
Stephan Wright14-Feb-05 2:37
Stephan Wright14-Feb-05 2:37 
GeneralRe: get string array length Pin
Fawxes14-Feb-05 3:26
Fawxes14-Feb-05 3:26 
GeneralRe: get string array length Pin
Stephan Wright14-Feb-05 6:32
Stephan Wright14-Feb-05 6:32 
GeneralRe: get string array length Pin
Scott Serl14-Feb-05 8:44
Scott Serl14-Feb-05 8:44 
GeneralData Table or Business Object Pin
Fawxes13-Feb-05 23:58
Fawxes13-Feb-05 23:58 
GeneralInsufficient system resources Pin
sayhigh13-Feb-05 22:32
sayhigh13-Feb-05 22:32 
GeneralRe: Insufficient system resources Pin
Dave Kreskowiak14-Feb-05 1:28
mveDave Kreskowiak14-Feb-05 1:28 
GeneralRe: Insufficient system resources Pin
sayhigh14-Feb-05 1:34
sayhigh14-Feb-05 1:34 
thanks for your reply.

The service is running under local system account.

<br />
'********************************************************************<br />
' Process: MoveFile<br />
' Input: oldPath, fileName, subDir ['Save'|'Error'], fid, Type ['NEW' | 'UV']<br />
' Output: Move file to destination folder<br />
'********************************************************************<br />
Public Sub MoveFile(ByVal oldPath As String, ByVal fileName As String, ByVal subDir As String, ByVal fid As Integer, ByVal type As String)<br />
        Dim Conn As New SqlConnection(strConn)<br />
        Dim fi As New FileInfo(oldPath)<br />
        Dim targetDir As String = ConfigurationSettings.AppSettings("dirPath" & type).Trim & "\" & subDir<br />
        Dim newPath As String = targetDir & "\" & fileName<br />
        Dim tblStatusName As String = ConfigurationSettings.AppSettings("tblStatusName" & type).Trim<br />
        Dim errorMsg As String<br />
        Dim attempt As Integer = 0<br />
<br />
        If File.Exists(newPath) Then<br />
            'Extra: To ensure delete only normal file (destination folder)<br />
            File.SetAttributes(newPath, FileAttributes.Normal)<br />
            File.Delete(newPath)<br />
        End If<br />
<br />
        'Try for another 5 attempts if meet "it is being used by another process" error<br />
        Do<br />
            Try<br />
                'Set the Read-Only file (source folder) to normal file before move to destination folder<br />
                If File.Exists(oldPath) Then<br />
                    File.SetAttributes(oldPath, FileAttributes.Normal)<br />
<br />
                    'If target folder not exist then create the folder<br />
                    If Not Directory.Exists(targetDir) Then<br />
                        Directory.CreateDirectory(targetDir)<br />
                    End If<br />
                    fi.MoveTo(newPath)<br />
<br />
                    'Log<br />
                    EvtLog("File successfully moved to " & newPath, localhost.EventLogEntryType.Information, 5)<br />
                    DBLog(logTableName, type, oldPath, "File successfully moved to " & newPath, logName, logSource)<br />
                End If<br />
<br />
                GoTo final<br />
<br />
            Catch ex As Exception<br />
                errorMsg = ex.ToString<br />
<br />
                If InStr(errorMsg, "it is being used by another process") <> 0 Then<br />
<br />
                    If attempt <= 5 Then<br />
                        EvtLog("*** Sub MoveFile Attempt " & attempt & " fail(" & oldPath & "): " & ex.ToString, localhost.EventLogEntryType.Error, 15)<br />
                        DBLog(logTableName, type, oldPath, "Sub MoveFile Attempt " & attempt & " fail: " & ex.ToString, logName, logSource)<br />
<br />
                        attempt += 1<br />
<br />
                        'Wait for 30 seconds before go for another attempt<br />
                        Thread.CurrentThread.Sleep(30000)<br />
                    End If<br />
<br />
                Else<br />
                    GoTo email<br />
                End If<br />
            End Try<br />
        Loop While attempt <= 5<br />
.....<br />
.....<br />
.....<br />
End Sub<br />


sayhigh
GeneralRe: Insufficient system resources Pin
Dave Kreskowiak14-Feb-05 5:34
mveDave Kreskowiak14-Feb-05 5:34 
GeneralRe: Insufficient system resources Pin
Kirk Quinbar15-Apr-09 10:54
Kirk Quinbar15-Apr-09 10:54 
GeneralVB.NET Datasets Pin
Mahesh167913-Feb-05 22:11
Mahesh167913-Feb-05 22:11 
GeneralRe: VB.NET Datasets Pin
Dave Kreskowiak14-Feb-05 1:26
mveDave Kreskowiak14-Feb-05 1:26 
GeneralRe: VB.NET Datasets Pin
Virus Detecter16-Feb-05 0:28
Virus Detecter16-Feb-05 0:28 
GeneralTriggering Event - Access Form Pin
FuzMic13-Feb-05 19:29
FuzMic13-Feb-05 19:29 
GeneralRe: Triggering Event - Access Form Pin
Dave Kreskowiak14-Feb-05 5:18
mveDave Kreskowiak14-Feb-05 5:18 
GeneralRe: Triggering Event - Access Form Pin
Mike the Red14-Feb-05 8:22
Mike the Red14-Feb-05 8:22 
GeneralHi Mike Red & Dave Pin
FuzMic14-Feb-05 19:30
FuzMic14-Feb-05 19:30 
GeneralVb Reading from Excel Pin
greg 77713-Feb-05 18:58
greg 77713-Feb-05 18:58 
GeneralRich Text Field - Background Pin
TomVerkaaik13-Feb-05 17:26
TomVerkaaik13-Feb-05 17:26 
GeneralConnecting scanner Pin
Avanti Dharkar13-Feb-05 0:52
Avanti Dharkar13-Feb-05 0:52 
GeneralRe: Connecting scanner Pin
H@is@here18-Feb-05 10:14
H@is@here18-Feb-05 10:14 
GeneralRe: Connecting scanner Pin
Avanti Dharkar19-Feb-05 3:52
Avanti Dharkar19-Feb-05 3:52 
QuestionCan some Help me with this over kill i know but ? Pin
Delo12-Feb-05 20:42
Delo12-Feb-05 20:42 
AnswerRe: Can some Help me with this over kill i know but ? Pin
Dave Kreskowiak13-Feb-05 17:27
mveDave Kreskowiak13-Feb-05 17:27 
QuestionHow to call a procedure Pin
Mekong River12-Feb-05 16:23
Mekong River12-Feb-05 16:23 

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.