joe joe - 4 months ago 37 Question

Cannot disable UltraGrid cells

I have an UltraGrid in my project. Data can be entered into each cell, which is then saved to the database. I want to be able to disable all of the cells in the current row EXCEPT for one called

. Once data has been entered into the active row column (this is entered via a
), I then want all of the other cells to become available for entering data into.

So far I have tried

If Me.ugProducts.ActiveRow.Cells("Product_Code").Value.ToString = "" Then
Me.ugProducts.ActiveRow.Cells("Product_Volume").Activation = Activation.Disabled
Me.ugProducts.ActiveRow.Cells("Product_Volume").Activation = Activation.AllowEdit
End If

But to no success. When the project is built, all of the cells are immediately available to type into, despite no value having been entered.

Why is it not working? What is the best way to do this?


I saw a previous comment on here that has since been deleted, for some reason... However, one solve you can try is:

  • In the form load; add in ugProducts.DisplayLayout.Override.CellClickAction = CellClickAction.CellSelect - This will mean all of the cells are disabled, but you'll still be able to select the ValueList for Product_Code
  • Now, in the CellListSelect event of ugProducts, use the following code ugProducts.DisplayLayout.Override.CellClickAction = CellClickAction.Edit (After any validation checks or anything that you have in the method already, it will go in here somewhere, just keep trying things if you aren't too sure where)

Anyway, this should now let you fill them in as you wish.