hey everyone,i did recently get my first simple button module to work (sort of) with dotnet but now i am on to trying to get some other projects converted over from VBA...i am now trying to convert one of my old projects which uses a drop-down from VBA to .net and i must be missing something?here is the main chunk of the code (with a few of the subroutines left out since they don't seem relevant)
Imports ESRI.ArcGIS.ArcMapUI
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Catalog
Imports ESRI.ArcGIS.DataSourcesGDB
Imports ESRI.ArcGIS.DataSourcesFile
Imports ESRI.ArcGIS.DataSourcesRaster
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.SystemUI
Imports ESRI.ArcGIS.esriSystem
Public Class CrewChiefSelect
Inherits ESRI.ArcGIS.Desktop.AddIns.ComboBox
Public Sub New()
'Set Active Data Frame to "Main"
SetActiveDataFrame()
'Populates CrewChief combo box with values from CrewChief layer and sorts them
Dim pMxDoc As IMxDocument
pMxDoc = My.ArcMap.Document
Dim pMap As IMap
pMap = pMxDoc.FocusMap
Dim pLayer3 As IFeatureLayer
Dim pData As IDataStatistics
Dim pCursor As ICursor
Dim pEnumVar As IEnumVariantSimple
Dim value As Object
Dim pTable As ITable
Me.Clear()
'Pull information for dropdown box
pLayer3 = pMap.Layer(2)
pTable = pLayer3
pCursor = pTable.Search(Nothing, False)
Dim pRow As IRow
pData = New DataStatistics
'Dim DISDAYCC As String
pRow = pCursor.NextRow
pData = pRow.Value(6)
'pData.Field("DISDAYCC")
pData.Cursor = pCursor
pEnumVar = pData.UniqueValues
value = pEnumVar.Next
Dim DiagCollection As New Collection
'Dim Inst
Do Until IsNothing(value)
If value = " " Then
value = pEnumVar.Next
Else
DiagCollection.Add(CStr(value))
End If
value = pEnumVar.Next
Loop
'DiagCollection = SortCollection(DiagCollection)
For Each Item In DiagCollection
Me.Add(Item)
Next
End Sub
Protected Sub Update(ByVal newIndex As Long)
Enabled = My.ArcMap.Application IsNot Nothing
ClearAll()
AddLayers()
Dim pMxDoc As IMxDocument
pMxDoc = My.ArcMap.Document
Dim pMap As IMap
pMap = pMxDoc.FocusMap
Dim pLayout As IPageLayout
pLayout = pMxDoc.PageLayout
Dim pActiveView As IActiveView
pActiveView = pMap
'Query for selecting points in CrewChief boundary
Dim strQuery As String
strQuery = """DISDAYCC""" & " = " & "'" & Me.Value & "'"
'Set pLayer to 2nd CrewChief polygon Layer
Dim pLayer As IFeatureSelection
pLayer = pMap.Layer(2)
'Set pLayer2 to 1st CrewChief District polygon Layer
Dim pLayer2 As IFeatureLayerDefinition
pLayer2 = pMap.Layer(1)
'Selects queried polygon from CrewChief layer
Dim pFilter As IQueryFilter
pFilter = New QueryFilter
pFilter.WhereClause = strQuery
pLayer.SelectFeatures(pFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
'
' Dim pBlueColor As IRgbColor
' Set pBlueColor = New RgbColor
' pBlueColor.RGB = RGB(0, 112, 225)
'
' Set pLayer.SelectionColor = pBlueColor
'Definition Query to Select CrewChief (Definition query to only display selected CrewChief boundary in the first crewchief layer so it thicker than other CrewChief boundaries)
pLayer2.DefinitionExpression = strQuery
'Selects queried Crewchief to zoom to the level of that selected CrewChief boundary
Dim pLayer3 As IFeatureLayer
pLayer3 = pMap.Layer(2)
Dim pFSel As IFeatureSelection
pFSel = pLayer3
Dim pSelSet As ISelectionSet
pSelSet = pFSel.SelectionSet
Dim pEnumGeom As IEnumGeometry
Dim pEnumGeomBind As IEnumGeometryBind
pEnumGeom = New EnumFeatureGeometry
pEnumGeomBind = pEnumGeom
pEnumGeomBind.BindGeometrySource(Nothing, pSelSet)
Dim pGeomFactory As IGeometryFactory
pGeomFactory = New GeometryEnvironment
Dim pGeom As IGeometry
pGeom = pGeomFactory.CreateGeometryFromEnumerator(pEnumGeom)
'Makes an envelope for selected features to determine proper page layout orientation
Dim pEnvelope As IEnvelope
pEnvelope = pGeom.Envelope
pEnvelope.XMax = pEnvelope.XMax + 100
pEnvelope.XMin = pEnvelope.XMin - 100
pEnvelope.YMax = pEnvelope.YMax + 100
pEnvelope.YMin = pEnvelope.YMin - 100
pMxDoc.ActiveView = pMap
pMxDoc.ActiveView.Extent = pEnvelope
'Determine the envelope ratio (for setting layout)
Dim intEnvelopeHeight As Long
intEnvelopeHeight = pEnvelope.YMax - pEnvelope.YMin
Dim intEnvelopeWidth As Long
intEnvelopeWidth = pEnvelope.XMax - pEnvelope.XMin
If intEnvelopeHeight > intEnvelopeWidth Then
strLayoutType = "Portrait"
ElseIf intEnvelopeHeight < intEnvelopeWidth Then
strLayoutType = "Landscape"
Else
strLayoutType = "Portrait"
End If
'Clear slection after zoom level is established
pMap.ClearSelection()
AddDataFrame()
AddTitle()
CreateAndAddNewMap()
InsertLogo()
ClearSelection()
End Sub
the code shows no errors when i debug it but when i add the drop-down into the arcmap project with the data it should reference it is grayed out...any help is much appreciated!thanks,max