Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Errors when running Hillshade tool from within Visual Basic.Net code

$
0
0
Hi guys,

This is my first attempt of trying to run a tool from within Visual Basic.Net code. I do not know whats wrong as when I tried to run it on ArcMap10, I got this error

Unhandled exception has occured in a component in your application. If you click Continue, the application will ignore this error and attempt to continue

Error HRESULT E _FAIL has been returned from a call to a COM component


I think there's something wrong with my code below. I tried to search for information on the internet but couldnt find any. Appreciate if anyone is kind enough to have a look and correct my code below please. Thank you.

Private Sub Calculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calculate.Click

' Initialize the geoprocessor.
Dim gp As Geoprocessor = New Geoprocessor()
Dim hillshadeTool As HillShade = New HillShade

' Local variables
Dim kl23_dem As Object = "kl23_dem"
Dim HillShadeOut As Object = "C:\\Users\\HillShadeTry"


Dim parameters As IVariantArray = New VarArray

' Populate the variant array with parameter values.
parameters.Add(kl23_dem)
parameters.Add(HillShadeOut)
parameters.Add("315")
parameters.Add("45")
parameters.Add("NO_SHADOW")
parameters.Add("1")

gp.Execute("Hillshade", parameters, Nothing)


End Sub

Viewing all articles
Browse latest Browse all 1374

Trending Articles