FlexGrid for WinForms
Formatting a Cell as Read-Only
Show AllShow All
Hide AllHide All

To make a single cell or multiple cells read-only, use the BeforeEdit event.

Single Cell Read-Only

You can make any cell in the grid read-only so that the data within it cannot be changed. For example, enter the following code to make the cell in column 1, row 1 read-only:

To write code in Visual Basic

To write code in C#

Multiple Cell Read-Only

You may also want to set multiple cells in the grid to read-only at one time. Suppose you have an editable grid used to enter customers' information, such as customer IDs, addresses, and orders. While the orders and addresses may change, the customer IDs will not. The code below assumes you have nine rows in your grid, and you would like to make all of the rows in the first column, the Customer ID column, read-only. Enter the following code:

To write code in Visual Basic

To write code in C#

This topic illustrates the following:

Notice that none of the cells in the Customer ID column are editable.


 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback