Hi,
I am using MapWinGis OCX 4.8.8 in a VS2010 C# project to evaluate the control for use in our c#app. Up until now I have been really impressed and I am hoping this is an easy one:
The app has a textbox where the end user can input some text. This 'text' is then used in a query against one of the shapefiles loaded into the control.
Today, the code began throwing an exception on my development machine and I do not know why. I have attempted:
-reinstalling the 'MapWinGIS-only-v4.8.8SR-32bit-installer.exe'
-restarting the machine.
-uninstalling the newly installed TortoiseSVN after attempting and failing to compile the OCX source.
Any ideas how I can get back to the state where this app succeeds in its call to .Table.Query()?
TIA
Here is the code:
I am using MapWinGis OCX 4.8.8 in a VS2010 C# project to evaluate the control for use in our c#app. Up until now I have been really impressed and I am hoping this is an easy one:
The app has a textbox where the end user can input some text. This 'text' is then used in a query against one of the shapefiles loaded into the control.
Today, the code began throwing an exception on my development machine and I do not know why. I have attempted:
-reinstalling the 'MapWinGIS-only-v4.8.8SR-32bit-installer.exe'
-restarting the machine.
-uninstalling the newly installed TortoiseSVN after attempting and failing to compile the OCX source.
Any ideas how I can get back to the state where this app succeeds in its call to .Table.Query()?
TIA
Here is the code:
string error = "";
object result = null;
// the text values must be placed in quotes; we need to shield them with \ sign in C#
// fields are must be placed in square brackets
string query = "[PID] = \"" + textBoxParcelID.Text + "\"";
fParcels.SelectNone();
try
{
if (fParcels.Table.Query(query, ref result, ref error))
{
int[] shapes = result as int[];
if (shapes != null)
{
for (int i = 0; i < shapes.Length; i++)
{
fParcels.set_ShapeSelected(shapes[i], true);
MapWinGIS.Shape shp = fParcels.get_Shape(shapes[i]);
string text = fParcels.get_CellValue(8, shapes[i]).ToString();
MapWinGIS.Point pnt = shp.Centroid;
fParcels.Labels.AddLabel(text, pnt.x, pnt.y, 0.0, -1);
}
axMap1.ZoomToSelected(layerHandleParcels);
MapWinGIS.Extents extentCurrent = (MapWinGIS.Extents)axMap1.Extents;
axMap1.ZoomOut(0.5);
}
//MessageBox.Show("Objects selected: " + fParcels.NumSelected);
}
else
{
//MessageBox.Show("No shapes agree with the condition.");
}
}
catch (Exception ex)
{
MessageBox.Show("Exception:" + ex.Message);
}
The Exception is: "System.Runtime.InteropServices.SEHException" "External component has thrown an exception"