Hi.
I have a Sub that calls a Boolean Function and exits the Sub if the Return
value is False. The problem is it's exiting the Sub even if the Return value
is True.
Here's my code.
Private MySub
If Not DownloadFIIDSFi le() Then Exit Sub
'---- Other code here
End Sub
Private Function DownloadFIIDSFi le() As Boolean
Try
'---- Some FTP commands
'--- Check that a file was downloaded
Dim sDirs() As String
sDirs = Directory.GetFi les(DownloadPat h)
iCnt = sDirs.GetLength (0)
If iCnt = 0 Then Return False
'--- Some other code
Return True
Catch e as Exception
'--- Som e error handling
End Try
End Function
I played around with the code e.g.
Dim bOK as Boolean
bOK = DownloadFIIDSFi le()
If bOK = False Then Exit Sub '******** bOK is True but it still went
to execute
'******** "Exit Sub"
statement.
Any suggestions will be greatly appreciated!
Rita
I have a Sub that calls a Boolean Function and exits the Sub if the Return
value is False. The problem is it's exiting the Sub even if the Return value
is True.
Here's my code.
Private MySub
If Not DownloadFIIDSFi le() Then Exit Sub
'---- Other code here
End Sub
Private Function DownloadFIIDSFi le() As Boolean
Try
'---- Some FTP commands
'--- Check that a file was downloaded
Dim sDirs() As String
sDirs = Directory.GetFi les(DownloadPat h)
iCnt = sDirs.GetLength (0)
If iCnt = 0 Then Return False
'--- Some other code
Return True
Catch e as Exception
'--- Som e error handling
End Try
End Function
I played around with the code e.g.
Dim bOK as Boolean
bOK = DownloadFIIDSFi le()
If bOK = False Then Exit Sub '******** bOK is True but it still went
to execute
'******** "Exit Sub"
statement.
Any suggestions will be greatly appreciated!
Rita
Comment