Run Code from a textbox

Joe Mamma said:
what happens when you execute this code:
PHP:
Script.AddObject("Form1", Me, True)
Script.ExecuteStatement("Form1.Text=""New Caption""")

do you get the same error, or does it change the title of your .NET form???
if error, did you follow all of the steps outlined in the 'Exposing .NET Components to COM'?
I am getting the same error when I try to refer to a control published as a property. . . give me a moment
 
I dont know why controls dont get published out.

here is a solution, it publishes out the properties of a control, instead of the control. Also calls a method of the form.
 

Attachments

Wow, thanks that worked really well. Now i've got adding buttons, lables, textboxes, etc. all covered. Now i have figured out how to add references:

This works:
Visual Basic:
        InitializeScript()
        Dim blank As String
        script.ExecuteStatement("blank = ""Works""")
        script.ExecuteStatement(textbox1.text)

you have to set the strings property inside the script. This can be bad if you want to get the property from something defined outside of the script.

Here is how you can do this:

Visual Basic:
Dim blank As String
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        script.Language = "VBScript"
        blank = "Hey"
	End Sub
    Public Property BlankString()
        Get
            Return blank
        End Get
        Set(ByVal Value)
            blank = Value
        End Set
    End Property

and then in the script do:
Visual Basic:
 script.ExecuteStatement("MsgBox(""Bye"" & Form1.BlankString)")

Thanks alot for you help. :) Doing that technique you can add as many things as you want :) Thanks alot. Bye now (and thanks for all the quick replies)
 
Thanks for kicking me in the *** to port over some things I have put on the back burner.

As soon as I get my script library manager, that runs against that db I posted, running I will post the project.

I found an issue with the db though. . . ado.net does not like tables named 'Language'
 
yikes, i just realized that you have to set the property of every single thing :S I'll have to find a way around that.

example: textbox1.text, textbox1.visible, etc...
 
decrypt said:
I don't want to compile .net code because i want to do something like this:

Visual Basic:
If blank = 1 Then
  script.ExecuteStatement(textbox1.Text)
End If
If blank = 2 Then
  script.ExecuteStatement(textbox2.Text)
End If

If you need it, take a look at my new library for .Net scripting NeoDataType.net
 
Back
Top