|
-
Aug 14th, 2000, 05:40 AM
#1
Thread Starter
New Member
Hi everybody,
here's my problem:
I have a set of FUNCTIONs and SUBs, and i have an input (let's say for example a textbox) in my VB project.
If someone types something into this textbox, and presses ENTER, i want a FUNCTION to be called, according to that input.
I COULD do something like this:
Select Case Text1.Text
Case "Show_Users"
Show_Users
Case "Connect"
Connect
Case "Preferences"
Preferences
End Select
However, it would be much easier, to have that Text1.Text evaluated, and processed as FUNCTION and SUB names instantly.
Especially, as I am going to have lots and lots of SUBs.
In another language (Cold Fusion to be specific), it is possble to do this by using the following code:
Evaluate(Text1.Text)
Now Text1.Text is translated to Code, and interpreted as such.
Do you know what I mean?
Is there some function or way to perform this trick in VB (6.0) ???
Any help is appreciated.
thanks,
Kevin
-
Aug 14th, 2000, 07:03 AM
#2
Fanatic Member
Not that I know of
There is a function to evaluate string expressions into mathematical expressions, but that's not what you need.
VB is different in the way it is interpeted from the other languages, so I think you'll have to stick to the Select Case.
Sorry,
Moi
-
Aug 14th, 2000, 07:52 AM
#3
Thread Starter
New Member
Scriptcontrol as a workaround?
I also considered using the Microsoft Script Control as a workaround, because i can have it execute statements as strings.
e.g.:
With ScriptControl1
.ExecuteStatement "Msgbox"
End With
or in my case:
With ScriptControl1
.ExecuteStatement Text1.Text
End With
The script control (which in fact just executes some VBScript), could offer me a solution, only, I cannot involve SUBs from, let's say, a module in my application.
e.g.:
With ScriptControl1
.ExecuteStatement "Create_Connection"
End With
Unless someone can tell me how to do this?
How can I call a routine which exists inside a module of my project, from inside the Script Control?
Thanks in advance,
Kevin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|