2

I am trying to learn ArcObjects through .Net with the help ESRI website and I copied one code snippet from ESRI help.arcgis.com and pasted it in my code. I am seeing this error message.

The type or namespace "converter" does not exist in esri.arcgis.adf

I do not understand this error. Please help me to solve it as I am new to this ArcObject.

I am using Arcgis 10.0 with .net framework 3.5

public override void OnMouseDown(int Button, int Shift, int X, int Y)
    {
        // TODO:  Add DrawGraphicLine.OnMouseDown implementation
        //Get the active view from the application object (that is, hook).
        IActiveView activeView = GetActiveViewFromArcMap(m_application);

        //Get the polyline object from the user's mouse clicks.
        IPolyline polyline = GetPolylineFromMouseClicks(activeView);

        //Make a color to draw the polyline. 
        IRgbColor rgbColor =    ESRI.ArcGIS.ADF.Converter.ToRGBColor(Color.FromArgb(255, 0, 0));

        //Add the user's drawn graphics as persistent on the map.
        AddGraphicToMap(activeView.FocusMap, polyline, rgbColor, rgbColor);

        //Only redraw the portion of the active view that contains graphics. 
        activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
    }
1

I believe ESRI have moved things around and the sample code you used is no longer valid as it is calling objects that "don't exist". In your defence the API help file can be very difficult to understand especially as Google tends to return links to older code samples.

To get to the Converter class I had to manually add into visual studio the dll:

"C:\Program Files (x86)\ArcGIS\DeveloperKit10.4\DotNet\ESRI.ArcGIS.ADF.Connection.Local.dll"

I then added the following at the top of the class: Imports ESRI.ArcGIS.ADF.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.