Home Forums WinForms controls Xceed Grid for WinForms insertionrow boolean

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #17141 |


    I have a insertionrow on my grid, one of the columns is boolean type, I want to set the insertioncell, of boolean type, to false ( so I don’t get the green square in the checkbox). How can I do this?

    vb.net please


    thanks in advance


    Imported from legacy forums. Posted by troy@querytool.com (had 1579 views)

    User (Old forums)
    Post count: 23064

    Hi Troy

     you can do like this :

    Private Sub myGrid_AddingDataRow(ByVal sender As System.Object, ByVal e As Xceed.Grid.AddingDataRowEventArgs) Handles myGrid.AddingDataRow
            If IsDBNull(e.DataRow.Cells(“myColumn”).Value) Then e.DataRow.Cells(“ID_myColumn”).Value = false
    End Sub


    Imported from legacy forums. Posted by Daniel (had 241 views)

    User (Old forums)
    Post count: 23064


    The previous answer won’t clear the checkbox on the InsertionRow.  It will still appear as a full green square.  To get rid of this green square, here is a possibility:

    include Xceed.Grid.Editors and Xceed.Grid.Viewers in your project, include this in your Form1.vb  

    and, it your Form1 class:

    Public Sub New()
      Xceed.Grid.Licenser.LicenseKey = “(your license key here)” 
      gridControl1.SingleClickEdit = True  ‘  change a checkbox value with a single click even if it’s not already selected, takes two clicks otherwise
      If insertionRow1 IsNot Nothing AndAlso insertionRow1.Cells(1) IsNot Nothing Then
       insertionRow1.Cells(“column2”).CellEditorManager = New CheckBoxEditor()
       insertionRow1.Cells(“column2”).CellViewerManager = New CheckBoxViewer()
       CType(insertionRow1.Cells(“column2”), InsertionCell).IdleValue = False  ‘  The idle value is what you see when the insertion row is not activated yet
      End If
    End Sub

    and you will also need this to put the IdleValue of the InsertionCell into the row that is being added:

    Private Sub gridControl1_AddingDataRow(ByVal sender As Object, ByVal e As AddingDataRowEventArgs) Handles gridControl1.AddingDataRow
      e.DataRow.Cells(“column2”).Value = (CType(insertionRow1.Cells(“column2”), InsertionCell)).IdleValue
    End Sub

    In a certain way, the insertion row is a template for the rows that will be added, as long as it is not activated.  It becomes activated when one of the IdleValues is changed.  The IdleValue is not automatically transfered in the Value field.  In the example above, I took for granted that your grid was named gridControl1, the column with the boolean value was “column2” and the insertion row was insertionRow1.  If your instances have different names, do the changes as needed.

    Imported from legacy forums. Posted by Ghislain (had 1548 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.