Results 1 to 3 of 3

Thread: How to constitue a method call using string concatation ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    0

    Red face

    Hi,
    I am facing a strange challenge..please help me out in that....
    Is it possible to constitue a method name using string concatation and then call that method?

    for example.. can I do something like this ?

    dim str as string
    str = "create" + "storer"
    call str
    or
    str

    this doesn't work and it will not, certainly....then what is the way to do this kind of stuff? please guide me to solution of this..


    Thanks and regards

    Mehul

  2. #2
    Guest
    what you are calling will be empty.
    it will do nothing.
    if you create the stuff before hand you can use a couple combo or list boxes, and when someone clicks a buton, you could do this

    Code:
    If List1.Text = "create" and List2.Text = "storer" Then
    Call createstorer
    End If
    I am not sure if this will work, but you may be able to do this.

    Code:
    Select Case List1.Text & List2.Text
    Case "createstorer"
    Call createstorer
    Case "etc"
    call Etc.......
    End Select

    oh. one more thing, its best to use the Ampersand(&) in string concatation.

    because Vb may try to recognize + as an arithmatic operator.

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    There's a CallByName Function If you know where the function's contained. for example if you knew that createstore was in an object clsCreate then you could use

    Code:
    CallByName clsCreate, "createstore"
    but I'm not sure about what to do I'f you don't know the object.

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