Hi Everyone, I need a sub that creates an instance of an object whose class name is passed in.
Sub CreateInstance(ByVal className as String) Dim obj As New "className"() ' "className" is whatever class name passed in End Sub I tried to use the Script Control as follows. but it throwed a System.Runtime.InteropServices.COMException Sub CreateInstance(ByVal className as String) Dim sc As MSScriptControl.ScriptControl sc = New MSScriptControl.ScriptControlClass() sc.Language = "VBScript" Dim command as String = "Dim obj As New " & className & "()" sc.ExecuteStatement(command) End Sub If you know what's going on, or you have other ideas to do this (VB or C#), please help me. Thanks so much, Shell [EMAIL PROTECTED] =================================== This list is hosted by DevelopMentorŪ http://www.develop.com You may be interested in Guerrilla .NET, 24 March 2003, in London and Boston http://www.develop.com/courses/gdotnet View archives and manage your subscription(s) at http://discuss.develop.com