Link to home
Start Free TrialLog in
Avatar of infowareindia
infowareindia

asked on

How to add object to script control in VB .NET 2008 Express

Hi

I am using Microsof Visual Basic .Net 2008 and Dot Net framework 3.5.

I'm using the following code.

Dim ScriptCntrl as New MSScriptControl.ScriptControlClass
Dim ObjTexbox as new TextBox
ObjTexbox.Name = "txtFirstName"

ScriptCntrl.AddObject(objTextBox.Name,objTextbox,true)


when I m executing the above code I'm getting following error

"Specified Cast is Not Valid"

What is the solution?





Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Are you sure that the ScriptContol.AddObject method accepts 3 arguments?  I am looking at the Microsoft page on the Script Control metjods, and AddObject appears to accept 2 (TWO) arguments, the Name (as a string), and the ControlObject, to be identified by that name.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin