C#, C♯, C#相談室 Part42
■ このスレッドは過去ログ倉庫に格納されています
0805デフォルトの名無しさん
2007/09/19(水) 00:32:29実行できるVBのResume機能を実現するにはどうすれば良いでしょうか?
gotoで処理するのが普通でしょうか?
VBだと以下のようにエラー発生時にリトライが簡単にできるのですが・・・
Private Function GetText() As Boolean
Dim strText(0 To 4) As String
Dim intFileNumber As Integer
Dim i As Long
intFileNumber = FreeFile
On Error GoTo ErrTrap:
Open "C:\Test.txt" For Input As #intFileNumber
For i = 0 To 4
Line Input #intFileNumber, strText(i)
If EOF(intFileNumber) = True Then
Exit For
End If
Next i
Close #intFileNumber:intFileNumber = 0
GetText = True
Exit Function
ErrTrap:
'タイムアップでなければリトライ
If Err.Number = 53 And m_blnTimeUp = False Then
Resume
End If
If intFileNumber > 0 Then
Close #intFileNumber
End If
GetText = False
End Function
■ このスレッドは過去ログ倉庫に格納されています