// -----------------------------------------------------------------------------------
    // Main functions for fingerprint recognition management
    // -----------------------------------------------------------------------------------

    // Initializes GrFinger ActiveX and all necessary utilities.
    public int InitializeGrFinger(AxGrFingerXLib.AxGrFingerXCtrl grfingerx)
    {
        GRConstants result;

        _grfingerx = grfingerx;
        //Check DataBase Class.
        if (_DB == null)
        {
            _DB = new DBClass();
        }
        //Open DataBase
        if (_DB.openDB() == false)
        {
            return(ERR_CANT_OPEN_BD);
        }

        //Create a new Template
        if (_tpt == null)
        {
            _tpt = new TTemplate();
        }

        //Create a new raw image
        _raw = new TRawImage();

        //Initialize library
        result = (GRConstants)_grfingerx.Initialize();
        if (result < 0)
        {
            return((int)result);
        }
        return((int)_grfingerx.CapInitialize());
    }
        public void InitializeGrFinger(AxGrFingerXLib.AxGrFingerXCtrl grfingerxFormAuth)
        {
            grfingerx = grfingerxFormAuth;
            grfingerx.Initialize();
            grfingerx.CapInitialize();

            template = new TTemplate();
        }