Search code examples
vb.netradio-buttoninfragisticsreadonlyultrawingrid

Set UltraGrid to ReadOnly property, vb.net


In my project, I have a form that has 3 radio buttons, an ultragrid, and a textbox. When I load the form, I want the ultragrid to be ReadOnly, or the equivalent of this, and then I want it to become active again when rbCategory is checked (one of the radiobuttons). I then need it to be set to ReadOnly again if one of the other 2 radio buttons are selected.

I feel like ReadOnly is not a property that can be used with Ultragrids, so what is the equivalent (to make it grey, like a ReadOnly textbox, basically), and how is this coded?

I tried using

ugCategories.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False

but this didn't seem to do the job


Solution

  • By setting AllowUpdate you are actually making the grid read-only. If you need to change the grid appearance you need to set appearance for the read-only cells like this:

    ugCategories.DisplayLayout.Override.ReadOnlyCellAppearance.BackColor = Color.Gray;
    

    Further, you may consider set and the CellClickAction to CellSelect like this:

    ugCategories.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect;
    

    You may also check this article for more helpful information from Mike Saltzman - Infragistics Win Forms Guru