Live Scores
Shareware
Movie Stars
in
Visual Basic.NET
Development
(Entire Site)
Questions and answers to issues related to Microsoft: Windows, Applications, Development, Hardware, Server, Internet Protocols, Database, Exchange .
»
Development
»
.NET
»
Visual Basic.NET
»
How to add object to script control in VB .NET 2008 Express
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.ScriptCont
rolClass
Dim ObjTexbox as new TextBox
ObjTexbox.Name = "txtFirstName"
ScriptCntrl.AddObject(objT
extBox.Nam
e,objTextb
ox,true)
when I m executing the above code I'm getting following error
"Specified Cast is Not Valid"
What is the solution?
Solution: How to add object to script control in VB .NET 2008 Express
It works for me...after fixing the typos and setting a Language. The name of the textbox wasn't consistent:
Dim ScriptCntrl As New MSScriptControl.ScriptCont
rolClass
ScriptCntrl.Language = "VBScript"
Dim ObjTextBox As New TextBox
ObjTextBox.Name = "txtFirstName"
ScriptCntrl.AddObject(ObjT
extBox.Nam
e, ObjTextBox, True)