<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to sort items in combobox? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393116#M10496</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pQueryFilterDefinition.PostfixClause = "ORDER BY Town"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;using IQueryFilterDefinition2 interface.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 May 2013 19:09:49 GMT</pubDate>
    <dc:creator>JimMeuse</dc:creator>
    <dc:date>2013-05-02T19:09:49Z</dc:date>
    <item>
      <title>How to sort items in combobox?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393114#M10494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to ask spesific question about sorting items in combobox from A to Z. How can i perform sorting them?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If i cant sort them A to Z there is meaningless about the query that will be applied on it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Waiting forward for your replies, kindly regards.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tolga&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are my vba codes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub UserForm_Initialize()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pMap As IMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatLayer As IFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatClass As IFeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFields As IFields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pField As IField&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim i As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pMap = pMxDoc.FocusMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatLayer = pMap.Layer(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatClass = pFeatLayer.FeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFields = pFeatClass.Fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; For i = 0 To pFields.FieldCount - 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cboMusteri.AddItem pFields.Field(i).Name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pLayer As ILayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pLayer = pMap.Layer(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatLayer = pLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeature As IFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pFeatCursor As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim pQueryFilter As IQueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pQueryFilter = New QueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pQueryFilter.SubFields = "MALIK"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatCursor = pFeatLayer.Search(pQueryFilter, True)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = pFeatCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim j As Integer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Dim cDuplicate As Boolean&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cDuplicate = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; cboMusteri.Clear&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do While Not pFeature Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; For j = 0 To cboMusteri.ListCount - 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cDuplicate = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; If cboMusteri.List(j) = pFeature.Value(pFeature.Fields.FindField("MALIK")) &amp;amp; "" Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cDuplicate = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Next j&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; If cDuplicate = False Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; cboMusteri.AddItem pFeature.Value(pFeature.Fields.FindField("MALIK")) &amp;amp; ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = pFeatCursor.NextFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatCursor = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeature = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pFeatLayer = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pLayer = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pMap = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Set pMxDoc = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 18:54:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393114#M10494</guid>
      <dc:creator>geomatic</dc:creator>
      <dc:date>2013-05-01T18:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort items in combobox?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393115#M10495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may want to see:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=992&amp;amp;t=88487"&gt;http://forums.esri.com/Thread.asp?c=93&amp;amp;f=992&amp;amp;t=88487&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 19:22:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393115#M10495</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2013-05-01T19:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort items in combobox?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393116#M10496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pQueryFilterDefinition.PostfixClause = "ORDER BY Town"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;using IQueryFilterDefinition2 interface.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 May 2013 19:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393116#M10496</guid>
      <dc:creator>JimMeuse</dc:creator>
      <dc:date>2013-05-02T19:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort items in combobox?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393117#M10497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jim's solution is good but it does not work with all data formats (i.e. Shapefiles) see this &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/13871-ArcObjects-10-Query-ordering-not-working-(IQueryFilterDefinition.PostfixClause)"&gt;thread&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Maybe try something like this:&lt;BR /&gt;&lt;BR /&gt;pQueryFilterDefinition.PostfixClause = "ORDER BY Town"&lt;BR /&gt;&lt;BR /&gt;using IQueryFilterDefinition2 interface.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2013 08:09:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393117#M10497</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2013-05-03T08:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort items in combobox?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393118#M10498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;just throw them into a list of strings first?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use c# to code in, but its pretty simple in both languages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;using system.Collections.Generic;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;List&amp;lt;String&amp;gt; cblist = new List&amp;lt;String&amp;gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cblist.Items.Add(Value);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cblist.Sort();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then you can either bind the list to the Combo box, or manually add them in by looping &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tomas.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 00:41:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-sort-items-in-combobox/m-p/393118#M10498</guid>
      <dc:creator>TomaCasa</dc:creator>
      <dc:date>2013-05-20T00:41:36Z</dc:date>
    </item>
  </channel>
</rss>

