PDA

Click to See Complete Forum and Search --> : How to constitue a method call using string concatation ?


Mehul
Jun 13th, 2000, 02:18 AM
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

Jun 13th, 2000, 04:44 AM
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


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.


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.

Sam Finch
Jun 13th, 2000, 04:57 AM
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



CallByName clsCreate, "createstore"



but I'm not sure about what to do I'f you don't know the object.