-
September 12th, 2003, 05:01 AM
#1
Execute Statement ????
Hello,
In VB we have this Statement running
Dim lvFrm as Form
Set lvFrm = FrmTest
msgbox lvFrm.Caption
if the Statement "Set lvFrm = FrmTest" is a STRING then how could we execute ? Using Script Control.
My aim is to Load a form using a String Statement.
I tried ScriptControl.ExecuteStatement "Load FrmTest"
An Error Popups " Typemismatch: 'Load' "
Any Solution.......
Thank you
Regards
Soundar
your's
Soundar
-
September 12th, 2003, 07:02 AM
#2
I'm not sure if it is exactly what you are looking for, but check into the CallByName() function.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
September 12th, 2003, 07:22 AM
#3
Execute Statement
hi.
I want to execute a String Statement "Load FrmTest" .. to Load a Form .
(FrmTest -> is a Form)
How do I call this Using Script Control..
Regards
Soundar
your's
Soundar
-
September 12th, 2003, 07:27 AM
#4
Take a look
http://www.codeguru.com/forum/showth...hreadid=205597
is in the sticky item: VB frequently asked questions.
I hope is what you need.
Jaime
-
September 12th, 2003, 07:49 AM
#5
Error Occurs
Hi,
Here the FormName is in String : its shows
Object Required : XYZ (FormName)
Or else how to Convert the String to Object ??
Soundar
your's
Soundar
-
September 12th, 2003, 07:51 AM
#6
Hi Dear
Please try this.
Set the Project Reference to Microsoft Script Control 1.0 from Project ->References
General Declaration Section
---------------------------------
Option Explicit
Dim scpt As ScriptControl
Dim frmMain
Form Load Event
----------------------
Set scpt = New ScriptControl
With scpt
.Language = "VBScript"
.AddObject "frmMain", Form2
End With
Command Button Click Event
------------------------------------
scpt.ExecuteStatement " MsgBox frmMain.Caption"
-
September 12th, 2003, 07:55 AM
#7
Still......
Hi... samitanveer
In your Code.. Form2 is an Object...
Consider if that is being a String ????
Reply me... I am Awaiting.....
Soundar
your's
Soundar
-
September 12th, 2003, 07:57 AM
#8
Hi bsoundar,
Another way to load the form is by adding it into VB.Forms collection, this is much simplier.
Code:
VB.Forms.Add "Form2"
Have a nice day
Busy
-
September 12th, 2003, 08:16 AM
#9
Thank You & to All
IT WORKS ! IT WORKS !! AND IT WORKS !!!!
Thanks A lot ....... " Thread1 "
and to all the members who atleast tried to give solutions...
Regards
Soundar
your's
Soundar
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
|