Results 1 to 5 of 5

Thread: Anyone implemented a CallByName for VB5?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Norway
    Posts
    112
    Have anyone made a CallByName for VB5 probably using API?

  2. #2
    Guest

    Unhappy Please explain (aussie joke)

    What fo you mean by a CallByName Function???????How should it work, hoe do you want it to work?????

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    CallByName is a new function in VB6 and not for others old VB version.

    Code:
    CallByName (Object, Procedure, Calltype, [Arguments()])
    sample code:
    Code:
    Private Sub cmdQuery_Click()
    Dim sType as String
    Dim vControl as Variant
    On Error GoTo errorhandler
    For Each vControl In Controls
       If vControl.Name = txtObject.Text Then
         Exit For
       End If
    Next
    
    If chkProp.Value = vbChecked Then
       If chkLet.Value = vbChecked Then
          CallByName vControl, txtPropMeth.Text, vbLet, txtValue
       Else
          txtValue = CallByName(vControl, txtPropMeth, vbGet)
       End If
    Else
       CallByName vControl, txtPropMeth.Text, vbMethod
    End If
    
    Exit Sub
    errorhandler:
    MsgBxo Err.Description
    End Sub
    Hope this will help.


  4. #4
    Guest

    Thumbs up That explains it then

    Am using VB5 SP3...............sad but true

  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Thumbs up Jethro, Explanation from Pauline (Aussie Joke Cont.)

    Call by name has some interesting uses.

    I have only used it once in a cut-down version of an XML parser which never saw the light of day

    I had one program running on one system and text arriving through the winsock in pseudo XML format could make RPC (Remote procedure calls) out of it.

    It is of course possible to have a case statement on the incoming text and call the function but I wanted to add new functions to the program and have the client software just call them from a text based browser.

    You can just pass a string containing the function name and it will call it.

    It's slower then proper function calls by a long way, you'd never use it in a performance algorithm but it can be used to "Open up" an app to the outside.

    VB5...

    Not any way I can think of to create this funtion youself but I can't see why you couldn't imitate the functionality you need, it's not really that usefull and usually (unless I'm missing the point of it) there is a better way of writing the program without it. To me it was a cheap and dirty short cut.
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width