thaluska

IRasterMakerOp.MakeConstant method

Discussion created by thaluska on Mar 9, 2011
Hello,
I attempted to use this code to create a grid from a constant (4137.37). I have inserted a MsgBox in the snippet where I get an error.  The error message is:

Error HRESULT E_FAIL has been returned from a call to a COM component.

Can anyone tell me what I am doing wrong?
thanks
tlh

'make stagegrid using IRasterMakerOp.MakeConstant method:
'StageMeters is a variable containing the value of 4137.37
Dim pRMakerOp As ESRI.ArcGIS.GeoAnalyst.IRasterMakerOp = New RasterMakerOp
Dim pStageGrid As IGeoDataset = pRMakerOp.MakeConstant(StageMeters, False)
Dim pLayerStage As IRasterLayer = New RasterLayer
MsgBox("Code is good up to here")
pLayerStage.CreateFromRaster(pStageGrid)
pLayerStage.Name = "StageGrid"
pMap.AddLayer(pStageGrid)
pMxDoc.ActiveView.Refresh()

Outcomes