I have an order system, where on the order screen, an order can be entered. To do this, it uses an UltraGrid
, where each row is an Order. See the image below.
I know that, somehow, it is possible to make an entire row non-overrideable, so that data in cells cannot be edited, and data cannot be entered into empty cells.
However, I need all of the cells to behave like this, except for one, until this cell has data in it. (Eg; all cells except for "Product Code" should be disabled, and then made available for editing once Product Code has been filled in). What is the code I need to do this?
I've tried using a With
statement to set the cells individually to ReadOnly
but this didn't seem to work.
EDIT
I have used the code below to make individual columns activation disabled, but I get the error message
Object reference not set to an instance of an object
Can anybody tell me why?
If ugProducts.ActiveRow.Cells("Product_Code").Value <> "" Then
ugProducts.DisplayLayout.Bands(0).Columns(1).CellActivation = Activation.Disabled
ugProducts.DisplayLayout.Bands(0).Columns(2).CellActivation = Activation.Disabled
ugProducts.DisplayLayout.Bands(0).Columns(3).CellActivation = Activation.Disabled
Else
End If
Thanks.
<>
to=
, as this is currently setting them to disabled if the value inProduct_Code
is not empty. What happens if you add.ToString
onto the end of.Value
? - David