method EditContext.Add (HTMLItem as String, [Item as Variant], [Image as Variant], [SortOrder as Variant])
Adds a new item to the control's context list.

TypeDescription
HTMLItem as String A string expression that may include HTML built- in tags that is displayed in the context popup list.
Item as Variant A string expression that specifies the text being inserted in the control's text when the user selects the item in the context popup menu. If missing, the HTMLItem with no HTML tags is being used.
Image as Variant A long expression that indicates the index of image in the item.
SortOrder as Variant A long expression that indicates the order of the item if the list gets sorted.

Use the Add method to add new items to the control's context collection. The control provides a collection called Context that helps you to add new items to context drop down portion. You can invoke the drop down context window, by pressing CTRL+SPACE. If you want to provide icons for items in the drop down portion, you have to use the Images method. Use the Sort method to get the items sorted. You can use the OnContext event to add new items to the Context collection when user invokes the control's context window.

The following VB sample adds few items to control's drop down portion:

With Edit1.Context("")
    .Add "<fgcolor=FF0000>class</fgcolor>", , 1
    .Add "<fgcolor=0000FF><b>public</fgcolor>", , 2
    .Add "<fgcolor=0000FF><b>protected</fgcolor>"
    .Add "<fgcolor=0000FF><b>private</fgcolor>", , 3
End With

The following C++ sample adds few items to the control's drop down portion:

#include "Context.h"
COleVariant vtMissing; vtMissing.vt = VT_ERROR;
CContext context = m_edit.GetContext( vtMissing );
context.Add("<fgcolor=FF0000>class</fgcolor>", vtMissing , COleVariant( long(1) ), vtMissing );
context.Add("<fgcolor=0000FF><b>public</fgcolor>", vtMissing , COleVariant( long(2) ), vtMissing );
context.Add("<fgcolor=0000FF><b>protected</fgcolor>", vtMissing , vtMissing, vtMissing );
context.Add("<fgcolor=0000FF><b>private</fgcolor>", vtMissing , COleVariant( long(3) ), vtMissing );

The following VB.NET sample adds few items to the control's drop down portion:

With AxEdit1.get_Context("")
    .Add("<fgcolor=FF0000>class</fgcolor>", , 1)
    .Add("<fgcolor=0000FF><b>public</fgcolor>", , 2)
    .Add("<fgcolor=0000FF><b>protected</fgcolor>")
    .Add("<fgcolor=0000FF><b>private</fgcolor>", , 3)
End With

The following C# sample adds few items to the control's drop down portion:

EXEDITLib.Context context = axEdit1.get_Context("");
context.Add("<fgcolor=FF0000>class</fgcolor>", null , 1, null );
context.Add("<fgcolor=0000FF><b>public</fgcolor>", null , 2, null);
context.Add("<fgcolor=0000FF><b>protected</fgcolor>", null, null, null);
context.Add("<fgcolor=0000FF><b>private</fgcolor>", null, 3, null);

The following VFP sample adds few items to the control's drop down portion:

With thisform.Edit1.Context("")
    .Add("<fgcolor=FF0000>class</fgcolor>", , 1)
    .Add("<fgcolor=0000FF><b>public</fgcolor>", , 2)
    .Add("<fgcolor=0000FF><b>protected</fgcolor>")
    .Add("<fgcolor=0000FF><b>private</fgcolor>", , 3)
EndWith