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. Image for the cookie policy date

TableControlCurrentCellStartEditing

Hi, I have a GridGrouingControl in witch I add column by the folowing methode : Public Sub CustomizedAddComboBoxColumn(ByVal strColumnFieldName As String, ByVal strColumnHeaderText As String, ByVal dtDataTable As DataTable, ByVal strDisplayMemberFieldName As String, ByVal strValueMemberFieldName As String, Optional ByVal strColumnTipText As String = "", Optional ByVal blnIsReadOnly As Boolean = False, Optional ByVal blnIsExclusiveChoiceList As Boolean = True, Optional ByVal intColumnWidth As Integer = 0) ''ByVal strColumnFieldName As String, ByVal strColumnHeaderText As String, ByVal intColumnWidth As Integer, ByVal dvParentDataView As DataView, Optional ByVal blnIsReadOnly As Boolean = False ''Add Column to VisibleColumn and Set a ComboBox column type Try Me.TableDescriptor.VisibleColumns.Add(strColumnFieldName) Me.TableDescriptor.Columns(strColumnFieldName).HeaderText = strColumnHeaderText Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.CellType = "ComboBox" Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.DataSource = dtDataTable Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.DisplayMember = strDisplayMemberFieldName Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.ValueMember = strValueMemberFieldName ''Set the DropDownStyle Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.DropDownStyle = GridDropDownStyle.AutoComplete Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.CellTipText = strColumnTipText Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.ExclusiveChoiceList = blnIsExclusiveChoiceList Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.ReadOnly = blnIsReadOnly ''Hide Button depending on blnIsReadOnly If blnIsReadOnly = True Then Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide Else Me.TableDescriptor.Columns(strColumnFieldName).Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.ShowCurrentCellEditing End If ''Set the Column Width If intColumnWidth <> 0 Then Me.TableDescriptor.Columns(strColumnFieldName).Width = intColumnWidth End If ''intColumnWidth <> 0 Catch ex As Exception MessageBox.Show(ex.Message, "PersoGridGroupingControl.CustomizedAddComboBoxColumn #1") End Try End Sub ''CustomizedAddComboBoxColumn #1 Now I would like to implement the following method to prevent the edit cursor from showing if the Cell is ReadOnly. But it doesn''t woork since I clear all visible column before I add Column to VisibleColumn. : Private Sub PersoGridGroupingControl_TableControlCurrentCellStartEditing(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs) Handles MyBase.TableControlCurrentCellStartEditing ''Prevent the edit cursor from showing if the Cell is ReadOnly Try Dim gccGridCurrentCell As GridCurrentCell = e.TableControl.CurrentCell Dim intField As Integer = e.TableControl.TableDescriptor.ColIndexToField(gccGridCurrentCell.ColIndex) Dim style As GridTableCellStyleInfo = e.TableControl.TableDescriptor.Columns(intField).Appearance.AnyRecordFieldCell If style.ReadOnly = True Then e.Inner.Cancel = True End If ''style.ReadOnly = True Catch ex As Exception MessageBox.Show(ex.Message, "PersoGridGroupingControl.PersoGridGroupingControl_TableControlCurrentCellStartEditing") End Try End Sub Please can somebody help me solve this problem ?

3 Replies

AD Administrator Syncfusion Team May 23, 2005 11:03 AM

Try this code to see if it does what you need.
Private Sub gridGroupingControl1_TableControlCurrentCellStartEditing(sender As Object, e As GridTableControlCancelEventArgs)
   Dim cc As GridCurrentCell = e.TableControl.CurrentCell
   Dim style As GridTableCellStyleInfo = e.TableControl.Model(cc.RowIndex, cc.ColIndex)
   If style.ReadOnly = True Then
      e.Inner.Cancel = True
   End If
End Sub ''gridGroupingControl1_TableControlCurrentCellStartEditing


PD Prof DISSOU Jamâl-Dine May 24, 2005 09:01 AM

Hi Clay, It doesn''t work. Best regards, Jamâl-Dine DISSOU


AD Administrator Syncfusion Team May 24, 2005 11:08 AM

It seems to work for me in this sample. Can you modify it to show the problem you are having? http://www.syncfusion.com/Support/user/uploads/GGC_ReadOnly_113389c2.zip

Loader.
Live Chat Icon For mobile
Up arrow icon