AnsweredAssumed Answered

IGxDialog Unable to Open Shapefiles

Question asked by Mats_Hardy on Mar 18, 2020
Latest reply on Mar 20, 2020 by kenbuja

I have tried to use IGxDialog to open shapefiles by the codes below:

 

public static string getInputFile()
{
    string filename;
    IEnumGxObject enumGxObj;
    IGxObject gxObj;
    IGxObjectFilterCollection gxFilterColl;
    IGxDialog gxDialog;
    IGxObjectFilter gxObjFilter;

 

    filename = "";
    try
    {
        gxDialog = new GxDialog();
        gxFilterColl = (IGxObjectFilterCollection)gxDialog;
        gxDialog.AllowMultiSelect = false;
        gxObjFilter = new GxFilterShapefiles();
        //gxDialog.ObjectFilter = gxObjFilter;
        gxFilterColl.AddFilter(gxObjFilter, true);

 

        if (gxDialog.DoModalOpen(0, out enumGxObj))
        {
            gxObj = enumGxObj.Next();
            filename = gxObj.FullName;
            Logger.Debug("getInputFile filename = " + filename);
        }
    }
    catch (Exception ex)
    {
        Logger.Debug("getInputFile error: " + ex.Message);
    }

    return filename;
}

 

But when the GxDialog is opened, the shapefiles are not found.

But the shapefiles are found in ArcCatalog

Are there any problems on the codes? Thanks.

Outcomes