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.


Thread ID:





29318 May 23,2005 11:21 AM May 24,2005 12:08 PM Windows Forms 3
Tags: GridControl
Prof DISSOU Jamâl-Dine
Asked On May 23, 2005 11:21 AM

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 ?

Administrator [Syncfusion]
Replied On May 23, 2005 12:03 PM

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

Prof DISSOU Jamâl-Dine
Replied On May 24, 2005 10:01 AM

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

Administrator [Syncfusion]
Replied On May 24, 2005 12:08 PM

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


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.