# Locking Control from Editing

## Content



By default the **C1NumericBox** control's **Value** property is editable by users at run time. If you want to lock the control from being edited, you can set the [IsReadOnly](/componentone/api/wpf/online-input-net/dotnet-api/C1.WPF.Input/C1.WPF.Input.C1NumericBox.IsReadOnly.html) property to True.

### In XAML

To lock the **C1NumericBox** control in XAML add **IsReadOnly="True"** to the **<c1:C1NumericBox>** tag so that it appears similar to the following:

```xml
<c1:C1NumericBox Name="C1NumericBox1" IsReadOnly="True" />
```

### In Code

To lock the **C1NumericBox** control from run-time editing in code, add the following to your project:

```vbnet
C1NumericBox1.IsReadOnly = True
```

```csharp
c1NumericBox1.IsReadOnly = true;
```

### At Design Time

To lock the **C1NumericBox** control from run-time editing, complete the following steps:

1.  Click the **C1NumericBox** control once to select it.
2.  Navigate to the **Properties** window, and check the **IsReadOnly** check box.

This will set the **IsReadOnly** property to **False**.

**Run your project and observe**:

The control is locked from editing; notice that the **Up** and **Down** buttons are grayed out and inactive:

![](https://cdn.mescius.io/document-site-files/images/47c7dd3c-b586-44f5-903c-f615f88e343f/images/numericbox/editlock.png)