Visual Basic Reference

Visual Studio 6.0

Locked Property

See Also    Example    Applies To

Returns or sets a value indicating whether a control can be edited.


object.Locked [ = boolean]

The Locked property syntax has these parts:

Part Description
Object An object expression that evaluates to an object in the Applies To list.
Boolean A Boolean expression that specifies whether the control can be edited, as described in Settings.


The settings for boolean are:

Setting Description
True TextBox control you can scroll and highlight the text in the control, but you can't edit it. The program can still modify the text by changing the Text property.
  Column object you can't edit the values in the column.
  ComboBox object you can't type in the textbox.
False TextBox control you can edit the text in the control.
  Column object you can edit the values in the column.
  ComboBox object you can type in the textbox and drop down its list.


For the Column object, the default setting of Locked is the value of the DataUpdatable property for the underlying field; however, if Column is unbound or the data source doesn't support DataUpdatable, the default is True. If DataUpdatable in the underlying field is False, you do not create an error by setting this property to True. However, an error will occur when the control attempts to write the changed data to the database.

For the ComboBox control, when Locked is set to True, the user cannot change any data, but can highlight data in the text box and copy it. This property does not affect programmatic access to the ComboBox.