property ComboBox.Locked as Boolean

Determines whether a control can be edited.

TypeDescription
Boolean A boolean expression that determines whether a control can be edited.

Use the Locked property to lock the control. When the control is locked the user is able to drop the control's list but he cannot change the selected value. Use the Enabled property to disable the control. Use the Locked property to refresh the font in the edit controls, after changing the control's font. Use the CellEnabled property to disable a cell. Use the EnableItem property to disable the item. For instance, changing the Locked property recreates the edit controls in the control's label area, if the Style property is DropDown.  If the control is locked, the edit controls in the control's label are read only. The system handles the look and appearance for a read only edit control.

The following VB sample changes the control's font at runtime:

With ComboBox1.Font
    .Name = "Comic Sans MS"
    .Bold = True
End With
ComboBox1.Locked = ComboBox1.Locked

The following C++ sample changes the control's font at runtime:

#include "font.h"
COleFont font = m_combobox.GetFont();
font.SetName("Comic Sans MS");
font.SetBold( TRUE );
m_combobox.SetLocked( m_combobox.GetLocked() );

The following VB.NET sample changes the control's font at runtime:

AxComboBox1.Font = New System.Drawing.Font("Comic Sans MS", 10, FontStyle.Bold)
AxComboBox1.Locked = AxComboBox1.Locked

The following C# sample changes the control's font at runtime:

axComboBox1.Font = new System.Drawing.Font("Comic Sans MS", 10, FontStyle.Bold);
axComboBox1.Locked = axComboBox1.Locked;

The following VFP sample changes the control's font at runtime:

With thisform.ComboBox1.Font
    .Name = "Comic Sans MS"
    .Bold = .t.
EndWith
thisform.ComboBox1.Locked = thisform.ComboBox1.Locked