# Setting up the Name Box

Learn how to use the Name Box control to create and display custom names at runtime in this comprehensive guide.

## Content

You can use the name box control to display or create custom names at run time. Custom names that are created by the name box can only refer to a cell or a range of cells.

## Setting up the Name Box

Select the name box control from the **Toolbox** and draw it on the form or use the [NameBox](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.NameBox.html) class to create the control at runtime. Then attach the control to Spread. The following image displays the NameBox control in the toolbox.
![Name Box Control](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/nameboxcontrol.png)

## Using the Name Box

To create a custom name, select a cell or range of cells in the Spread control, type a custom name in the name box control, and then press the equal key to create the custom name.
Use the drop-down list in the name box control to display the custom names. You can select one of the names to see the cell or cell range that the name refers to.
![Custom names in the Name Box Control](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/namebox1.png)

## Using Code

Create the name box and attach it to the control.

## Example

This example code creates a name box control and a custom name.

```csharp
fpSpread1.ActiveSheet.AddCustomName("Alpha", "A1:B1", 0, 0);
                
                FarPoint.Win.Spread.NameBox namebox1 = new FarPoint.Win.Spread.NameBox();
                namebox1.Location = new Point(0, 0);
                namebox1.Size = new Size(80, 20);
                this.Controls.Add(namebox1);
                namebox1.Attach(fpSpread1);
```

```vbnet
fpSpread1.ActiveSheet.AddCustomName("Alpha", "A1:B1", 0, 0)
                
                Dim namebox1 As New FarPoint.Win.Spread.NameBox()
                namebox1.Location = New Point(0, 0)
                namebox1.Size = New Size(80, 20)
                Controls.Add(namebox1)
                namebox1.Attach(fpSpread1)
```

## See Also

[Formulas in Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula)
[Placing a Formula in Cells](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulaplace)
[Specifying a Cell Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacellref)
[Specifying a Sheet Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulasheetref)
[Specifying an External Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-externalref)
[Using a Circular Reference in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacircref)
[Nesting Functions in a Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulanested)
[Recalculating and Updating Formulas Automatically](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formularecalc)
[Finding a Value Using GoalSeek](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formula-goalseek)
[Allowing the User to Enter Formulas](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulaallowuser)
[Creating and Using a Custom Name](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacustomname)
[Creating and Using a Custom Function](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulacustomfunc)
[Creating and Using External Variable](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-external-variable)
[Using the Array Formula](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-arrayformula)
[Working with the Formula Text Box](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-formulabar)
[Using Language Package](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/UsingLanguagePackage)
[Accessing Data from Header or Footer](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-headerfooterformula)
[Managing External Reference](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/spwin-extrenalreference)
[Working With Dynamic Array Formulas](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-cell-formula/WorkingWithDynamicArrayFormulas)