Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to trap COM instantiation
Message
From
31/07/2003 16:18:31
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00815490
Message ID:
00815607
Views:
8
This message has been marked as the solution to the initial question of the thread.
I do not understand why you need to declare this object twice, and since I'm writing primary on VB, I try to simulate your situation. Because I do not have your object installed, I make tests with ADO library.

So, I create new C# application and have this Load event for Form1:
private void Form1_Load(object sender, System.EventArgs e)
{
	ADODB.ConnectionClass adocnnTest;
	try
	{
		adocnnTest = new ADODB.ConnectionClass();
	}
	catch
	{
		MessageBox.Show("Error", "Error: Missing Required Files", MessageBoxButtons.OK, MessageBoxIcon.Stop);

		return;
	}

	adocnnTest.ConnectionString = "bla-bla";

}
This code compiles and works fine. What I said was that you have declaration of the same object in another place. Just remove that second declaration - if you use object only in this procedure, declare the object into it, as I do in my example. If you use object also outside of the procedure, move local declaration to the class scope (outside of the Load in my example) - this will guarantee that you can access object also from another procedures.

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform