DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

calling function

This is a discussion on calling function within the ASP Development forums, part of the Programming & Scripting category; hi i have one function which send message named sendmessage.this function returns false if sending failed.now i want to give ...

Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

  #1  
Old November 4th, 2008, 03:01 PM
guddu's Avatar
Barn Enthusiast
 
Join Date: Jul 2008
Location: Oxford UK
Posts: 334
Rep Power: 2
guddu is on a distinguished road
Default calling function

hi
i have one function which send message named sendmessage.this function returns false if sending failed.now i want to give 3 tries to this function in case of failure.i meant this function will be called maximum three time in case of failure.and in all 3 attempts message being not send then i want to call a error routine.how to do this.

Code:
 bReturn = SendMessage(BatchGuid, "Admin", "TR",Senderid, 1, asLines(i), Null)
      If Not bReturn Then
        'raise an error
        mClientErrorAdd asLines(i), _
                          ERR_NO_GHS_MESSAGE_SEND
      End If
hope it make some sense.
__________________
Love is physical attraction and mental destruction

Last edited by guddu; November 4th, 2008 at 03:03 PM.
Reply With Quote
  #2  
Old November 4th, 2008, 03:11 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

You can wrap it in a For...Next statement, checking the condition each time.

For example:
Code:
For i = 1 To 3
    bReturn = SendMessage(BatchGuid, "Admin", "TR",Senderid, 1, asLines(i), Null)
    If bReturn Then
        ' Message was sent, exit loop
        Exit For
    Else
        ' There was an error, if 3rd attempt, call error message routine
        If i = 3 Then
            ERR_NO_GHS_MESSAGE_SEND
        End If
    End If
Next
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding

Reply With Quote
  #3  
Old November 5th, 2008, 09:32 AM
guddu's Avatar
Barn Enthusiast
 
Join Date: Jul 2008
Location: Oxford UK
Posts: 334
Rep Power: 2
guddu is on a distinguished road
Default

JMH thanks a lot.did the trick.
Reply With Quote
  #4  
Old November 5th, 2008, 09:34 AM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,964
Blog Entries: 8
Rep Power: 15
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default

Quote:
Originally Posted by guddu View Post
JMH thanks a lot.did the trick.
Cheers, Guddu...glad I could help
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:24 PM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2