method ComboBox.EndUpdate ()

Resumes painting the control after painting is suspended by the BeginUpdate method.

TypeDescription

The BeginUpdate method locks painting control, and the EndUpdate method unlocks painting the control. Once that BeginUpdate was invoked you should be sure that EndUpdate will be called when you done all operations into the combobox controls. The BeginUpdate and EndUpdate methods increases the speed of loading your items, by preventing painting the control when it suffers any change. 

The following VB sample uses the BeginUpdate and EndUpdate methods to prevent painting during loading items from a recordset:

Set rs = CreateObject("ADODB.Recordset")
rs.Open "Orders", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB", 3 ' Opens the table using static mode

ComboBox1.BeginUpdate
For Each f In rs.Fields
    ComboBox1.Columns.Add f.Name
Next
ComboBox1.PutItems rs.GetRows()
ComboBox1.EndUpdate

The following VB sample prevents painting the control during loading columns and items:

With ComboBox1
    .BeginUpdate
    .Columns.Add ("Column 1")
    With .Items
        .AddItem "Item 1"
        .AddItem "Item 2"
    End With
    .EndUpdate
End With

The following C++ sample prevents painting the control during loading columns and items:

m_combobox.BeginUpdate();
CColumns columns = m_combobox.GetColumns();
columns.Add( "Column 1" );
CItems items = m_combobox.GetItems();
items.AddItem( COleVariant("Item 1") );
items.AddItem( COleVariant("Item 2") );
items.AddItem( COleVariant("Item 3") );
m_combobox.EndUpdate();

The following VB.NET sample prevents painting the control during loading columns and items:

With AxComboBox1
    .BeginUpdate()
    .Columns.Add("Column 1")
    With .Items
        .AddItem("Item 1")
        .AddItem("Item 2")
    End With
    .EndUpdate()
End With

The following C# sample prevents painting the control during loading columns and items:

axComboBox1.BeginUpdate();
axComboBox1.Columns.Add("Column 1");
axComboBox1.Items.AddItem("Item 1");
axComboBox1.Items.AddItem("Item 2");
axComboBox1.EndUpdate();

The following VFP sample prevents painting the control during loading columns and items:

With thisform.ComboBox1
    .BeginUpdate
    .Columns.Add ("Column 1")
    With .Items
        .AddItem("Item 1")
        .AddItem("Item 2")
    EndWith
    .EndUpdate
EndWith