Here is my code:
using System;
using fvw;
namespace ITS
{
public class FalconView
{
private int hLayer;
private fvw.LayerClass layer;
public FalconView()
{
hLayer = -1;
layer = new LayerClass();
}
public void Open(string clientName,
Int32 windowHandle, object dispatchPtr)
{
int result;
result = layer.RegisterWithMapServer
(clientName,windowHandle,dispatchPtr);
hLayer = layer.CreateLayer("ITS");
}
I have a form that calls this class.
When I call open from my main application I get InvalidCastException
Error. I think this is because layer is null. The reason I say this is
because when I create a new FalconView object. The FalconView software
kicks off and then immediately closes. The leads me to believe that my
object is possibly being cleaned up by the garbage collector. If I bind
the LayerClass object in the open method I dont get this error. Also,
if run the application again then everything runs fine. So this code
basically works every other time that is called. I cant explain why
this is happening.
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!