CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    Chennai
    Posts
    42

    Question How to Call this Statement ???

    Hi..

    How to call this Statement using ScriptControl.


    "Load FrmTest"


    Regards
    Soundar

    Note: this problem can also be solved using Forms Collection. My intension is how to use the ScriptControl for this Statement.
    your's
    Soundar

  2. #2
    Join Date
    Nov 2002
    Posts
    278
    Make a reference in your project to. . .
    Microsoft Script Control

    Code:
    Private Sub Form_Load()
    Dim objScript As ScriptControl
    Dim sScriptCode As String
    
        Set objScript = New ScriptControl
    
        
        sScriptCode = "Sub FrmTest" & vbCrLf
        sScriptCode = sScriptCode & "MsgBox " & Chr$(34) & "Hello World" & Chr$(34) & vbCrLf
        sScriptCode = sScriptCode & "End Sub"
        
        Debug.Print sScriptCode
        
        With objScript
            .Language = "VBScript"
            .AddCode "Option Explicit" & vbCrLf & sScriptCode
            .Run "FrmTest"
        End With
        
        
        Set objScript = Nothing
    
    End Sub
    Last edited by DinoVaught; September 15th, 2003 at 03:02 PM.

  3. #3
    Join Date
    Jul 2003
    Location
    Chennai
    Posts
    42
    Hi DinoVaught ,

    Thank you for the Response.

    But. ...... ! Let me tell you my actual requirement which I missed to do in the earlier...

    In my application i have planned to have a shortcut toolbar which is dynamically created by each user (like creating the shortcut in Windows).

    So, i can dynamically created command button based on the User choice. now i have to call that form which is exist in the Application.

    And iam storing the Form Name in the database as a string dataType.

    Hope this explanation would clearly mean what iam expecting..


    Awaiting for your reply..... Thank You !
    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
  •  





Click Here to Expand Forum to Full Width

Featured