Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Converting C# to VB.net

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-11 : 13:33:23
I have samples of C# code that I need to use to instantiate an object. I need to convert it to VB.net.

I have a dll called ProjectUtilities. It is referenced in .net as "InteractiveSoftworks.VoiceNet.ProjectUtilities"

I need to instantiate the ProjectManager object of the dll, but in order to do that it requires certain values to be passed.

Here is the C# code:

(Class Constructor):
Public ProjectManager(string sSystemDatabase, ScriptModel[] arrScm, IScriptModelFactory objScmFactory)

(Actual instantiation):
ProjectManager pm = new ProjectManager("Voicenet", new ScriptModel [] {scriptmodel.AgentScriptModel, ScriptModel.IVRScriptModel}, new ScriptModelFactory());


The constructor requires 3 arguments
1. A string
2. An array of constants
3. An object

Here is my code in VB.NET:

Dim oScriptModelFactory As New InteractiveSoftworks.VoiceNet.ProjectUtilities.ScriptModelFactory
Dim oScriptModel As New InteractiveSoftworks.VoiceNet.ProjectUtilities.ScriptModel
Dim arrScriptModel(,)

'I am setting the constants here
Dim sAgentScriptModel = InteractiveSoftworks.VoiceNet.ProjectUtilities.ScriptModel.AgentScriptModel
Dim sIVRScriptModel = InteractiveSoftworks.VoiceNet.ProjectUtilities.ScriptModel.IVRScriptModel

'Now trying to pass them
Dim oProjectManager As New InteractiveSoftworks.VoiceNet.ProjectUtilities.ProjectManager("NG2468", arrScriptModel(sAgentScriptModel, sIVRScriptModel), oScriptModelFactory)



I'm getting Object Refernce Not Set to Instance of Object
Am I passing the array incorrectly?

I would appreciate any help,
Ninel
   

- Advertisement -