Results 1 to 5 of 5

Thread: Script control errors in VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    12

    Question Script control errors in VB6

    Hi,

    I have a VB6 form with the following

    Textbox (Text1)
    Microsoft Script Control v1.0 (scCTRL)
    command1 button


    The command button has the code

    Private Sub Command1_Click()
    FldName = "Text1"
    scCTRL.ExecuteStatement FldName & ".Enabled = False"
    End Sub


    When it runs I get the following error

    Object Required : 'Text1'

    Any ideas ??

    Regards
    Karl.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Script control errors in VB6

    Not familiar with the script control; never used it. But for what you are doing, you don't need it.

    Me.Controls(fldName).Enabled = False
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    12

    Re: Script control errors in VB6

    Quote Originally Posted by LaVolpe View Post
    Not familiar with the script control; never used it. But for what you are doing, you don't need it.

    Me.Controls(fldName).Enabled = False
    Wow - that was a quick reply.

    What about if the field is indexed i.e Text1(0)

    Cheers

  4. #4
    Junior Member
    Join Date
    Jul 2009
    Posts
    30

    Re: Script control errors in VB6

    Don't need it as LaVolpe said, but I think you need to call: ScriptObject.AddObject Text1

    But:

    vb Code:
    1. Me.Controls("Text1")(0).Enabled = False

    should work.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    12

    Re: Script control errors in VB6

    Quote Originally Posted by vbpHacker View Post
    Don't need it as LaVolpe said, but I think you need to call: ScriptObject.AddObject Text1

    But:

    vb Code:
    1. Me.Controls("Text1")(0).Enabled = False

    should work.

    Great ! - Me.Controls("Text1")(0).Enabled = False works as expected.

    With regards the line you mentioned for the script control component..

    ScriptObject.AddObject Text1

    Regards
    Karl
    It throws an error message

    'Argument not optional '

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