method Context.Sort (Ascending as Boolean)
Sorts the items.

 TypeDescription 
   Ascending as Boolean A boolean value that indicates whether the items get sorted ascendant or descendent.   
Use the Add method of the Context object to specifies the SortOrder number.  All items that are added using the Add method without specifying the SortOrder parameter, have 0 for the SortOrder by default. The items are sorted by SortOrder number. The Sort method sorts alphabetically the list of items that have the same SortOrder parameter.  

The following VB sample sorts the list of items as follows:

With Edit1.Context
        .Add "<b>a</b>", , , 9
        .Add "<b>b</b>", , , 8
        .Add "<b>c</b>", , , 7
        
        .Sort True
End With

 and the list of items is 'c', 'b', 'a'. 

The following VB sample sorts the list as follows:

With Edit1.Context
        .Add "<b>a</b>"
        .Add "<b>b</b>"
        .Add "<b>c</b>"
        
        .Sort True
End With

 and the list of items is 'a', 'b', 'c'. 

With Edit1.Context
        .Add "<b>a</b>"
        .Add "<b>b</b>", , , 9999
        .Add "<b>c</b>"
        
        .Sort True
End With

 and the list of items is 'a', 'c', 'b'.  

The following C++ sample sorts the list of items as follows:

#include "Context.h"
COleVariant vtMissing; vtMissing.vt = VT_ERROR;
CContext context = m_edit.GetContext( vtMissing );
context.Add("<b>a</b>", vtMissing , vtMissing, COleVariant( long(9) ) );
context.Add("<b>b</b>", vtMissing , vtMissing, COleVariant( long(8) ) );
context.Add("<b>c</b>", vtMissing , vtMissing, COleVariant( long(7) ) );
context.Sort( TRUE );

 and the list of items is 'c', 'b', 'a'.

The following VB.NET sample sorts the list of items as follows:

With AxEdit1.get_Context("")
    .Add("<b>a</b>", , , 9)
    .Add("<b>b</b>", , , 8)
    .Add("<b>c</b>", , , 7)
    .Sort(True)
End With

 and the list of items is 'c', 'b', 'a'.

The following C# sample sorts the list of items as follows:

EXEDITLib.Context context = axEdit1.get_Context("");
context.Add("<b>a</b>", null , null, 9 );
context.Add("<b>b</b>", null, null, 8);
context.Add("<b>c</b>", null, null, 7);
context.Sort(true);

 and the list of items is 'c', 'b', 'a'.

The following VFP sample sorts the list of items as follows:

With thisform.Edit1.Context()
	.Add("<b>a</b>", , , 9)
	.Add("<b>b</b>", , , 8)
	.Add("<b>c</b>", , , 7)
	.Sort(.t.)
EndWith

 and the list of items is 'c', 'b', 'a'.

 

 

 


Send comments on this topic.
1999-2008 Exontrol Inc, Software. All rights reserved.