POST
|
I am having a similar problem. I am writing a program using Visual Basic 2010 Express which reads from an Oracle database. The program was working fine under ArcGIS Explorer 1750, but when I upgraded to ArcGIS Explorer 2500, I got the error �??ORA-06413: Connection not open�?�. After a week of trying to get it to work, I am ready to give up and go back to the 1750 version.
... View more
03-06-2013
09:42 AM
|
0
|
0
|
200
|
POST
|
I have found the solution to my own problem. I am new at using VB.net and I was trying to convert a program written in Visual Basic for Applications (VBA). In VBA, the following function call will allow you to run code when the tool is deactivated (my program was named MoveIt): Private Function MoveIt_Deactivate() As Boolean MoveSite_Deactivate = True End Function When I did a Google search for "arcgis deactivate tool", I found several programs with the following code: Public Function Deactivate() As Boolean Implements ESRI.ArcGIS.SystemUI.ITool.Deactivate ' Deactivate the tool. Return True End Function While this code may have worked in ArcGIS 8 and 9 (probably under VB 6), it no longer works in ArcGIS 10 and VB.net. However, the following program (which uses the function OnDeactivate) will work: Public Class Tool1 Inherits ESRI.ArcGIS.Desktop.AddIns.Tool Public Sub New() ' happens only when the tool is first loaded MsgBox("Hello New") End Sub Protected Overrides Sub OnUpdate() Enabled = My.ArcMap.Application IsNot Nothing End Sub Protected Overrides Sub OnActivate() MyBase.OnActivate() ' happens every time the tool is activated MsgBox("Hello Activate") End Sub Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs) MyBase.OnMouseDown(arg) ' Do something to show that the tool is working MsgBox("OnMouseDown - another mouse down") End Sub Protected Overrides Function OnDeactivate() As Boolean Dim Response As String Response = MsgBox("Do You really want to leave?", MsgBoxStyle.YesNo, "OnDeactivate") If Response = vbYes Then OnDeactivate = True Else OnDeactivate = False End If End Function End Class If you want to try this code, first start Visual Basic (I am using Visual Basic 2008 Express Edition) and under File/New Project create a new ArcMap Desktop Add-in. Include a tool in the project (it will probably be named Tool1 or ArcGISAddin1). Open the vb code window for the tool and delete everything but the first line (the line that starts with Public Class...). Then copy all of the above code except for the first line and paste it in your project (this ensures that the name of the tool will match the name in the Config.esriaddinx window). Then press the F5 key to start debugging and enter ArcGIS. In ArcGIS open a map and enter the Customize Mode. Find your tool in the Add-IN Controls category (under the Commands tab) and drag it to a tool bar. Exit Customize Mode and click on the tool to activate it.
... View more
03-21-2012
09:36 AM
|
0
|
0
|
366
|
POST
|
I am using Visual Basic 2008 Express to develop a tool for correcting the locations of features. The user first selects the feature, then activates the tool and clicks on the correct location. The tool then starts edit mode and relocates the feature. At this point I want ArcMap to remain in edit mode until the user deactivates the tool, after which the user will be asked if he wants to save his edits. My problem is that I cannot figure out how to acquire control when the tool is deactivated. The following simplified code illustrates the approach that I am trying to use. However, VB2008 gives the following error: "Interface 'ESRI.ArcGIS.SystemUI.ITool' is not implemented by this class". Can anyone tell me what I am doing wrong? Public Class MoveIt Inherits ESRI.ArcGIS.Desktop.AddIns.Tool Public Sub New() MsgBox("Hello") End Sub Protected Overrides Sub OnUpdate() Enabled = My.ArcMap.Application IsNot Nothing End Sub Public Function Deactivate() As Boolean Implements ESRI.ArcGIS.SystemUI.ITool.Deactivate MsgBox("GoodBy") Deactivate = True End Function End Class
... View more
03-16-2012
09:59 AM
|
0
|
3
|
1269
|
Online Status |
Offline
|
Date Last Visited |
02-01-2023
04:44 PM
|