We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

CheckBox column click

Thread ID:

Created:

Updated:

Platform:

Replies:

3186 Mar 7,2003 03:04 AM Mar 26,2003 10:13 AM Windows Forms 1
loading
Tags: FAQ
Administrator [Syncfusion]
Asked On March 7, 2003 03:04 AM

I have a datagrid in my column that has one DataGridBoolColumn (check box) and several text columns. I created bool column with a following code: Dim Col As New DataGridBoolColumn() Col.HeaderText = "Select" Col.MappingName = "Select" Col.AllowNull = False Col.TrueValue = True Col.FalseValue = False tableStyle.GridColumnStyles.Add(unboundColStyle) After this I have a column with a check box. Now I'd like to get rid of this DBNull value that comes when I click the check box. I added this code to the mouseDown event in the grid: Dim hti As DataGrid.HitTestInfo = Me.dgr.HitTest(e.X, e.Y) Try If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column = 0 Then Me.dgr(hti.Row, hti.Column) = Not CBool(dgr(hti.Row, hti.Column)) End If Catch ex As Exception MessageBox.Show(ex.ToString()) End Try This code crashes because checkbox has a value DBNull. So, how to get rid of this DBNull value? And does anyone know why the check box is disabled(gray) at the beginning?

Administrator [Syncfusion]
Replied On March 26, 2003 10:13 AM

The grey box means the value is NULL. > I have a datagrid in my column that has one DataGridBoolColumn (check box) and several text columns. I created bool column with a following code: > > Dim Col As New DataGridBoolColumn() > > Col.HeaderText = "Select" > Col.MappingName = "Select" > > Col.AllowNull = False > > Col.TrueValue = True > Col.FalseValue = False > > tableStyle.GridColumnStyles.Add(unboundColStyle) > > After this I have a column with a check box. Now I'd like to get rid of this DBNull value that comes when I click the check box. I added this code to the mouseDown event in the grid: > > > Dim hti As DataGrid.HitTestInfo = Me.dgr.HitTest(e.X, e.Y) > > Try > > If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column = 0 Then > > Me.dgr(hti.Row, hti.Column) = Not CBool(dgr(hti.Row, hti.Column)) > > End If > > Catch ex As Exception > MessageBox.Show(ex.ToString()) > End Try > > This code crashes because checkbox has a value DBNull. So, how to get rid of this DBNull value? And does anyone know why the check box is disabled(gray) at the beginning?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;