1. Tag Results
celltype (71)
1 - 25 of 71
How to set folder browser cell type in WinForms GridControl?
Folder browser cell type To use the FolderBrowser cell type, create custom FolderBrowserCellModel and FolderBrowserCellRenderer derived from GridTextBoxCellModel and GridTextBoxCellRenderer. The Folder Browser dialog box will be displayed in the OnButtonClicked event. Creating CustomCellModel C# //Deriving  GridTextBoxCellModel. public class FolderBrowserCellModel : GridTextBoxCellModel {     protected FolderBrowserCellModel(SerializationInfo info, StreamingContext context)         : base(info, context)     {         //Set the button bar size.         base.ButtonBarSize = new Size(20, 20);             }     //Constructor for the Derived Class     public FolderBrowserCellModel(GridModel grid)         : base(grid)     {       }     //Override the CreateRenderer() in the Base class.     public override GridCellRendererBase CreateRenderer(GridControlBase control)     {         //Return the Custom Renderer Object         return new FolderBrowserCellRenderer(control, this);     } }   Creating CustomCellRenderer //Deriving the GridTextBoxCellRenderer. public class FolderBrowserCellRenderer : GridTextBoxCellRenderer {     //FolderBrowser object declaration.     private System.Windows.Forms.OpenFileDialog folderBrowser1;     public FolderBrowserCellRenderer(GridControlBase grid, GridTextBoxCellModel cellModel)         : base(grid, cellModel)     {         AddButton(new BrowseButton(this));           //Initialize the folderBrowser1 object.         this.folderBrowser1 = new System.Windows.Forms.OpenFileDialog();     }     #region [overrides]            protected override void OnButtonClicked(int rowIndex, int colIndex, int button)     {         base.OnButtonClicked(rowIndex, colIndex, button);         if(folderBrowser1.ShowDialog()== DialogResult.OK)        {             string filePath = folderBrowser1.FileName;            }             }    }   Adding CellModel // Add the custom cell type to the CellModels of the GridControl. this.gridControl1.CellModels.Add("FolderBrowser", new FolderBrowserCellModel(gridControl1.Model));   // Set the cell type to "FolderBrowser" this.gridControl1[2, 3].Text = "Browse here"; this.gridControl1[2, 3].CellType = "FolderBrowser";   Samples: FolderBrowser celltype in grid  ConclusionI hope you enjoyed learning about how to set folder browser cell type in WinForms GridControl.You can refer to our  WinForms GridControl feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridControl documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to get cell type using C#/VB.NET?
This article explains how to get cell type using C#/VB.NET in WinForms XIsIO. What is cell type? Cell type specifies value type of the cell in the worksheet. The cell type in XlsIO can be Blank, Error, Boolean, Number, Formula and String. Cell Type Description Blank Blank indicates that the cell does not contain any value. Error Error type shows the cell value is an error value. Boolean If the cell contains TRUE/FALSE, then the cell type will be Boolean. Number Number indicates that the cell contains a number value. Formula Formula refers that the cell contains a formula. String String denotes that the cell contains a text value.   To get the cell type, you need to follow the below steps. Steps to get cell type Get the cell range to get the cell type. Use the WorksheetImpl.GetCellType(int row, int column, bool bNeedFormulaSubType) to get the cell type.foreach (IRange range in worksheet.UsedRange) {     // Get cell type     WorksheetImpl.TRangeValueType cellType = (worksheet as WorksheetImpl).GetCellType(range.Row, range.Column, false);       // Add the cell type as text into worksheet     worksheet[range.Row + 1, range.Column].Text = cellType.ToString();     worksheet[range.Row + 1, range.Column].CellStyle.Font.Bold = true; }   To know more about cell manipulation in XlsIO, please refer the documentation. Download Input file Download complete sample The following C#/VB.NET complete code snippet shows how to get cell type in XlsIO. using Syncfusion.XlsIO; using Syncfusion.XlsIO.Implementation; using System.IO; using System.Reflection;   namespace XlsIO_Sample {     class Program     {         public static void Main(string[] args)         {             // Instantiate the spreadsheet creation engine             using (ExcelEngine excelEngine = new ExcelEngine())             {                 IApplication application = excelEngine.Excel;                   // Open existing workbook with data entered                 Assembly assembly = typeof(Program).GetTypeInfo().Assembly;                 Stream workbookStream = assembly.GetManifestResourceStream("XlsIOSample.Sample.xlsx");                   IWorkbook workbook = application.Workbooks.Open(workbookStream);                 IWorksheet worksheet = workbook.Worksheets[0];                   foreach (IRange range in worksheet.UsedRange)                 {                     // Get cell type                     WorksheetImpl.TRangeValueType cellType = (worksheet as WorksheetImpl).GetCellType(range.Row, range.Column, false);                       // Add the cell type as text into worksheet                     worksheet[range.Row + 1, range.Column].Text = cellType.ToString();                     worksheet[range.Row + 1, range.Column].CellStyle.Font.Bold = true;                 }                   // Save and close the workbook                 Stream stream = File.Create("Output.xlsx");                 workbook.SaveAs(stream);             }         }     } }     Imports Syncfusion.XlsIO Imports Syncfusion.XlsIO.Implementation Imports System.IO Imports System.Reflection   Namespace XlsIO_Sample       Class Program           Public Shared Sub Main(ByVal args As String())             'Instantiate the spreadsheet creation engine             Using excelEngine As ExcelEngine = New ExcelEngine()                   Dim application As IApplication = excelEngine.Excel                   'Open existing workbook with data entered                 Dim assembly As Assembly = GetType(Program).GetTypeInfo().Assembly                 Dim workbookStream As Stream = assembly.GetManifestResourceStream("XlsIOSample.Sample.xlsx")                   Dim workbook As IWorkbook = application.Workbooks.Open(workbookStream)                 Dim worksheet As IWorksheet = workbook.Worksheets(0)                   For Each range As IRange In worksheet.UsedRange                     'Get cell type                     Dim cellType As WorksheetImpl.TRangeValueType = (TryCast(worksheet, WorksheetImpl)).GetCellType(range.Row, range.Column, False)                       'Add cell type as text into worksheet                     worksheet(range.Row + 1, range.Column).Text = cellType.ToString()                     worksheet(range.Row + 1, range.Column).CellStyle.Font.Bold = True                 Next                   'Save and close the workbook                 Dim stream As Stream = File.Create("Output.xlsx")                 workbook.SaveAs(stream)             End Using         End Sub     End Class End Namespace   The following screenshot shows the output generated by XlsIO after getting the cell type. Take a moment to peruse the documentation where you can find basic Excel document processing options along with the features like import and export data, chart, formulas, conditional formatting, data validation, tables, pivot tables and, protect the Excel documents, and most importantly, the PDF, CSV and Image conversions with code examples.Conclusion I hope you enjoyed learning about how to get cell type using C#/VB.NET. You can refer to our WinForms XIsIO’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms XIsIO documentation to understand how to present and manipulate data. For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms XIsIO and other WinForms components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!  
How to change the checkbox size based on DPI?
By default, the WinForms Gridcontrol will not be changed based on current DPI. So, checkbox will be drawn with the default size in all DPI. In order to change the CheckBox size based on the current DPI, the CheckboxSize property of GridCheckBoxCellRenderer class can be used. Code Snippet C# //To change the CheckBox size based on DPI. GridCheckBoxCellRenderer renderer = this.gridControl1.CellRenderers["CheckBox"] as GridCheckBoxCellRenderer; System.Drawing.Size checkboxSize = renderer.CheckBoxSize; //Default DPI float defaultDpi = 96; float currentDpi; using (Graphics g = this.CreateGraphics()) {     currentDpi = g.DpiX;     if (currentDpi != defaultDpi)     {         float scalefactor = currentDpi / defaultDpi;         renderer.CheckBoxSize = new Size((int)(scalefactor * checkboxSize.Width), (int)(scalefactor * checkboxSize.Height));     } }   VB 'To change the CheckBox size based on DPI. Dim renderer As GridCheckBoxCellRenderer = TryCast(Me.gridControl1.CellRenderers("CheckBox"), GridCheckBoxCellRenderer) Dim checkboxSize As System.Drawing.Size = renderer.CheckBoxSize 'Default DPI Dim defaultDpi As Single = 96 Dim currentDpi As Single Using g As Graphics = Me.CreateGraphics()     currentDpi = g.DpiX     If currentDpi <> defaultDpi Then         Dim scalefactor As Single = currentDpi / defaultDpi             renderer.CheckBoxSize = New Size(CInt(Fix(scalefactor * checkboxSize.Width)), CInt(Fix(scalefactor * checkboxSize.Height)))     End If End Using   Screenshot   Note:The CheckBoxsize can also be changed in GridGroupingControl for current DPI as the same way.   Getting the GridCheckBoxCellRenderer C# GridCheckBoxCellRenderer renderer = this.gridGroupingControl1.TableControl.CellRenderers["CheckBox"] as GridCheckBoxCellRenderer;   VB Dim renderer As GridCheckBoxCellRenderer = TryCast(Me.gridGroupingControl1.TableControl.CellRenderers("CheckBox"), GridCheckBoxCellRenderer)   Sample Link: C#: CheckBoxSize_CS  VB: CheckBoxSize_VB   ConclusionI hope you enjoyed learning about how to change the checkbox size based on DPI.You can refer to our WinForms GridControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal We are always happy to assist you!
How to customize the combobox button for combobox celltype in WinForms GridGroupingControl?
Customize the combobox button By default, ComboBox dropdown appearance cannot be customized. In order to customize the ComboBox appearance, the GridListControl cell type can be used instead of using the ComboBox cell type. This can be enabled by disabling the EnableLegacyStyle property or using the GridListControl cell type. Please make use of the below customization to customize the appearance, ComboBox Button Customization The DrawCellButtonBackground event can be used to customize the dropdown button of the cell.  C# //Triggering the event. this.gridGroupingControl1.TableControl.DrawCellButtonBackground += new GridDrawCellButtonBackgroundEventHandler(TableControl_DrawCellButtonBackground);   //Event customization.  void TableControl_DrawCellButtonBackground(object sender, GridDrawCellButtonBackgroundEventArgs e)  {      if (e.Style.CellType == GridCellTypeName.ComboBox)      {          ThemedComboBoxDrawing.DropDownState btnState = ThemedComboBoxDrawing.DropDownState.Normal;          int rowIndex = e.Style.CellIdentity.RowIndex;          int colIndex = e.Style.CellIdentity.ColIndex;            bool isHovering = e.Button.IsHovering(rowIndex, colIndex);          bool isMouseDown = e.Button.IsMouseDown(rowIndex, colIndex);            bool disabled = !e.Style.Clickable;            if (disabled)          {              btnState = ThemedComboBoxDrawing.DropDownState.Disabled;          }          else if (isMouseDown)          {              btnState = ThemedComboBoxDrawing.DropDownState.Pressed;          }          else if (isHovering)          {              btnState = ThemedComboBoxDrawing.DropDownState.Hot;          }   //Customize the ComboBox Button.   this.gridGroupingControl1.TableModel.Options.GridVisualStylesDrawing.DrawComboBoxStyle(e.Graphics, e.Button.Bounds, btnState, Color.Gray);          Bitmap bitmap = new Bitmap(@"..\..\Resources\down.png");           //Customize the icon of ComboBox.          iconPaint.PaintIcon(e.Graphics, e.Button.Bounds, Point.Empty, bitmap, Color.Black);          e.Cancel = true;      }  }   VB 'Triggering the event. AddHandler gridGroupingControl1.TableControl.DrawCellButtonBackground, AddressOf TableControl_DrawCellButtonBackground   'Event customization.  Private Sub TableControl_DrawCellButtonBackground(ByVal sender As Object, ByVal e As GridDrawCellButtonBackgroundEventArgs)      If e.Style.CellType Is GridCellTypeName.ComboBox Then          Dim btnState As ThemedComboBoxDrawing.DropDownState = ThemedComboBoxDrawing.DropDownState.Normal          Dim rowIndex As Integer = e.Style.CellIdentity.RowIndex          Dim colIndex As Integer = e.Style.CellIdentity.ColIndex            Dim isHovering As Boolean = e.Button.IsHovering(rowIndex, colIndex)          Dim isMouseDown As Boolean = e.Button.IsMouseDown(rowIndex, colIndex)            Dim disabled As Boolean = Not e.Style.Clickable            If disabled Then              btnState = ThemedComboBoxDrawing.DropDownState.Disabled          ElseIf isMouseDown Then              btnState = ThemedComboBoxDrawing.DropDownState.Pressed          ElseIf isHovering Then              btnState = ThemedComboBoxDrawing.DropDownState.Hot          End If    'Customize the ComboBox Button. Me.gridGroupingControl1.TableModel.Options.GridVisualStylesDrawing.DrawComboBoxStyle(e.Graphics, e.Button.Bounds, btnState, Color.Gray)          Dim bitmap As New Bitmap("..\..\Resources\down.png")          'Customize the icon of ComboBox.          iconPaint.PaintIcon(e.Graphics, e.Button.Bounds, Point.Empty, bitmap, Color.Black)          e.Cancel = True      End If  End Sub   Dropdown customization The drop-down part can be customized by using the PrepareViewStyleInfo event of the GridListControl cell. C# GridCellRendererBase cellRenderer = this.gridGroupingControl1.TableControl.CellRenderers["ComboBox"]; renderer = (cellRenderer as GridDropDownGridListControlCellRenderer); //Triggering the event of combobox cell renderer renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);   //Event customization. void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) {     e.Style.TextColor = Color.White;       if (renderer.ListControlPart.Grid.CurrentCell.RowIndex == e.RowIndex)     {         e.Style.BackColor = Color.PaleGreen;     }     e.Style.Font.Facename = "Segoe UI";     e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.Green); }   VB Dim cellRenderer As GridCellRendererBase = Me.gridGroupingControl1.TableControl.CellRenderers("ComboBox") renderer = (TryCast(cellRenderer, GridDropDownGridListControlCellRenderer)) 'Triggering the event of combobox cell renderer AddHandler renderer.ListControlPart.Grid.PrepareViewStyleInfo, AddressOf Grid_PrepareViewStyleInfo   'Event customization. void Grid_PrepareViewStyleInfo(Object sender, GridPrepareViewStyleInfoEventArgs e)     e.Style.TextColor = Color.White       If renderer.ListControlPart.Grid.CurrentCell.RowIndex = e.RowIndex Then         e.Style.BackColor = Color.PaleGreen     End If     e.Style.Font.Facename = "Segoe UI"     e.Style.Borders.Bottom = New GridBorder(GridBorderStyle.Solid, Color.Green)   Screenshot   Samples: C#: Customization of ComboBox Button CS VB: Customization of ComboBox Button VB Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/celltypes
How to add new record while clicking push button placed in add new record in WinForms GridGroupingControl?
Adding new record In order to add a new record while clicking the PushButton in last column of the AddNewRecord, Table.EndEdit() method can be used in TableControlPushButtonClick event. C# //Triggering the event this.gridGroupingControl1.TableControlPushButtonClick += newGridTableControlCellPushButtonClickEventHandler(gridGroupingControl1_TableControlPushButtonClick);    //Event Customization void gridGroupingControl1_TableControlPushButtonClick(object sender, GridTableControlCellPushButtonClickEventArgs e)  {      //To add record on button click.      this.gridGroupingControl1.Table.EndEdit();  }    VB 'Triggering the event AddHandler gridGroupingControl1.TableControlPushButtonClick, AddressOf gridGroupingControl1_TableControlPushButtonClick   'Event Customization Private Sub gridGroupingControl1_TableControlPushButtonClick(ByVal sender As Object, ByVal e As GridTableControlCellPushButtonClickEventArgs)     'To add record on button click.     Me.gridGroupingControl1.Table.EndEdit() End Sub   Samples: C#: AddNewRecord CS VB: AddNewRecord VB
How to make a ComboBox cell as case sensitive in WinForms GridGroupingControl?
Set Combobox cell as case sensitive The ComboBox cell can be make as case sensitive by override the FindItem method for custom CellRenderer(CustomComboBoxCellRenderer) to ignore the case insensitive and override the ApplyFormattedText for custom CellModel(CustomComboBoxCellModel) to set the given text to the ComboBox. The following are the steps that need to be followed, Step 1: Create CustomComboBoxCellModel by deriving it from GridComboBoxCellModel class. C# public class CustomComboBoxCellModel : GridComboBoxCellModel {     public CustomComboBoxCellModel(GridModel grid)         : base(grid)     {         AllowFloating = false;         ButtonBarSize = new Size(SystemInformation.VerticalScrollBarWidth, 0);         SupportsChoiceList = true;     }     GridComboBoxListBoxHelper listBox;     public override GridCellRendererBase CreateRenderer(GridControlBase control)     {         return new CustomComboBoxCellRenderer(control, this);     }     public override bool ApplyFormattedText(GridStyleInfo style, string text, int textInfo)     {         if (text.Length > 0 && text != null && (style.ChoiceList == null || style.ChoiceList.Count == 0))         {             if (style.DisplayMember != style.ValueMember)             {                 style.CellValue = text;                 return true;             }         }         return base.ApplyFormattedText(style, text, textInfo);     }   } VB Public Class CustomComboBoxCellModel     Inherits GridComboBoxCellModel     Public Sub New(ByVal grid As GridModel)         MyBase.New(grid)         AllowFloating = False         ButtonBarSize = New Size(SystemInformation.VerticalScrollBarWidth, 0)         SupportsChoiceList = True     End Sub     Private listBox As GridComboBoxListBoxHelper     Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase         Return New CustomComboBoxCellRenderer(control, Me)     End Function     Public Overrides Function ApplyFormattedText(ByVal style As GridStyleInfo, ByVal text As String, ByVal textInfo As Integer) As Boolean         If text.Length > 0 AndAlso text IsNot Nothing AndAlso (style.ChoiceList Is Nothing OrElse style.ChoiceList.Count = 0) Then             If style.DisplayMember <> style.ValueMember Then                 style.CellValue = text                 Return True             End If         End If         Return MyBase.ApplyFormattedText(style, text, textInfo)     End Function End Class Step 2: Create CustomComboBoxCellRenderer from the GridComboBoxCellRenderer. C# public class CustomComboBoxCellRenderer : GridComboBoxCellRenderer {     public CustomComboBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel)         : base(grid, cellModel)     {         DropDownImp.InitFocusEditPart = true;         DropDownButton = new GridCellComboBoxButton(this);     }     public override int FindItem(string prefix, bool selectItem, int start, bool ignoreCase)     {         ignoreCase = false;         return base.FindItem(prefix, selectItem, start, ignoreCase);     } } VB Public Class CustomComboBoxCellRenderer     Inherits GridComboBoxCellRenderer     Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)         MyBase.New(grid, cellModel)         DropDownImp.InitFocusEditPart = True         DropDownButton = New GridCellComboBoxButton(Me)     End Sub     Public Overrides Function FindItem(ByVal prefix As String, ByVal selectItem As Boolean, ByVal start As Integer, ByVal ignoreCase As Boolean) As Integer         ignoreCase = False         Return MyBase.FindItem(prefix, selectItem, start, ignoreCase)     End Function End Class Step 3: Set the CustomComboBoxCellModel into default ComboBox cell. GridControl C# this.gridControl1.Model.CellModels["ComboBox"] = new CustomComboBoxCellModel(this.gridControl1.Model); this.gridControl1.ColStyles[1].CellType = GridCellTypeName.ComboBox; VB Me.gridControl1.Model.CellModels("ComboBox") = New CustomComboBoxCellModel(Me.gridControl1.Model) Me.gridControl1.ColStyles(1).CellType = GridCellTypeName.ComboBox GridGroupingControl C# this.gridGroupingControl1.TableModel.CellModels["ComboBox"] = new CustomComboBoxCellModel(this.gridGroupingControl1.TableModel.Model); this.gridGroupingControl1.TableDescriptor.Columns["Name"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox; VB Me.gridGroupingControl1.TableModel.CellModels("ComboBox") = New CustomComboBoxCellModel(Me.gridGroupingControl1.TableModel.Model) Me.gridGroupingControl1.TableDescriptor.Columns("Name").Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox Screenshot GridControl GridGroupingControl Samples: GridControl C#: GridControl with ComboBox CS VB: GridControl with ComboBox VB GridGroupingControl C#: GridGroupingControl with ComboBox CS VB: GridGroupingControl with ComboBox VBConclusionI hope you enjoyed learning about how to make a ComboBox cell as case sensitive in WinForms GridGroupingControl.You can refer to our WinForms GridGrouping feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to make a ComboBox cell as case sensitive in WinForms GridControl and GridGroupingControl?
Set Combobox cell as case sensitive The ComboBox cell can be make as case sensitive by override the FindItem method for custom CellRenderer(CustomComboBoxCellRenderer) to ignore the case insensitive and override the ApplyFormattedText for custom CellModel(CustomComboBoxCellModel) to set the given text to the ComboBox. The following are the steps that need to be followed, Step 1: Create CustomComboBoxCellModel by deriving it from GridComboBoxCellModel class. C# public class CustomComboBoxCellModel : GridComboBoxCellModel {     public CustomComboBoxCellModel(GridModel grid)         : base(grid)     {         AllowFloating = false;         ButtonBarSize = new Size(SystemInformation.VerticalScrollBarWidth, 0);         SupportsChoiceList = true;     }     GridComboBoxListBoxHelper listBox;     public override GridCellRendererBase CreateRenderer(GridControlBase control)     {         return new CustomComboBoxCellRenderer(control, this);     }     public override bool ApplyFormattedText(GridStyleInfo style, string text, int textInfo)     {         if (text.Length > 0 && text != null && (style.ChoiceList == null || style.ChoiceList.Count == 0))         {             if (style.DisplayMember != style.ValueMember)             {                 style.CellValue = text;                 return true;             }         }         return base.ApplyFormattedText(style, text, textInfo);     }   } VB Public Class CustomComboBoxCellModel     Inherits GridComboBoxCellModel     Public Sub New(ByVal grid As GridModel)         MyBase.New(grid)         AllowFloating = False         ButtonBarSize = New Size(SystemInformation.VerticalScrollBarWidth, 0)         SupportsChoiceList = True     End Sub     Private listBox As GridComboBoxListBoxHelper     Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase         Return New CustomComboBoxCellRenderer(control, Me)     End Function     Public Overrides Function ApplyFormattedText(ByVal style As GridStyleInfo, ByVal text As String, ByVal textInfo As Integer) As Boolean         If text.Length > 0 AndAlso text IsNot Nothing AndAlso (style.ChoiceList Is Nothing OrElse style.ChoiceList.Count = 0) Then             If style.DisplayMember <> style.ValueMember Then                 style.CellValue = text                 Return True             End If         End If         Return MyBase.ApplyFormattedText(style, text, textInfo)     End Function End Class Step 2: Create CustomComboBoxCellRenderer from the GridComboBoxCellRenderer. C# public class CustomComboBoxCellRenderer : GridComboBoxCellRenderer {     public CustomComboBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel)         : base(grid, cellModel)     {         DropDownImp.InitFocusEditPart = true;         DropDownButton = new GridCellComboBoxButton(this);     }     public override int FindItem(string prefix, bool selectItem, int start, bool ignoreCase)     {         ignoreCase = false;         return base.FindItem(prefix, selectItem, start, ignoreCase);     } } VB Public Class CustomComboBoxCellRenderer     Inherits GridComboBoxCellRenderer     Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)         MyBase.New(grid, cellModel)         DropDownImp.InitFocusEditPart = True         DropDownButton = New GridCellComboBoxButton(Me)     End Sub     Public Overrides Function FindItem(ByVal prefix As String, ByVal selectItem As Boolean, ByVal start As Integer, ByVal ignoreCase As Boolean) As Integer         ignoreCase = False         Return MyBase.FindItem(prefix, selectItem, start, ignoreCase)     End Function End Class Step 3: Set the CustomComboBoxCellModel into default ComboBox cell. GridControl C# this.gridControl1.Model.CellModels["ComboBox"] = new CustomComboBoxCellModel(this.gridControl1.Model); this.gridControl1.ColStyles[1].CellType = GridCellTypeName.ComboBox; VB Me.gridControl1.Model.CellModels("ComboBox") = New CustomComboBoxCellModel(Me.gridControl1.Model) Me.gridControl1.ColStyles(1).CellType = GridCellTypeName.ComboBox GridGroupingControl C# this.gridGroupingControl1.TableModel.CellModels["ComboBox"] = new CustomComboBoxCellModel(this.gridGroupingControl1.TableModel.Model); this.gridGroupingControl1.TableDescriptor.Columns["Name"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox; VB Me.gridGroupingControl1.TableModel.CellModels("ComboBox") = New CustomComboBoxCellModel(Me.gridGroupingControl1.TableModel.Model) Me.gridGroupingControl1.TableDescriptor.Columns("Name").Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox Screenshot GridControl GridGroupingControl Samples: GridControl C#: GridControl with ComboBox CS VB: GridControl with ComboBox VB GridGroupingControl C#: GridGroupingControl with ComboBox CS VB: GridGroupingControl with ComboBox VB
How to trigger an event when the ComboBox DropDownList has null value or has no datasource bound to it?
If the ComboBox in WinForms GridControl is neither bound to any datasource not has list items, it can be notified to the user by clicking on it. The notification message that the user wants to display can be given through TableControlCurrentCellShowingDropDown event. Code Snippet C# // form() // Trigger the required event. gridControl1.CurrentCellShowingDropDown += gridControl1_CurrentCellShowingDropDown;   void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e) {      GridComboBoxCellRenderer rend = gridControl1.CurrentCell.Renderer as GridComboBoxCellRenderer;      ListBox list = rend.ListBoxPart;      if(list.Items.Count==0)      {           MessageBox.Show("ComboBox is Empty");      } }   VB ' form() ' Trigger the required event. Private gridControl1.CurrentCellShowingDropDown += AddressOf gridControl1_CurrentCellShowingDropDown     Private Sub gridControl1_CurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridCurrentCellShowingDropDownEventArgs)    Dim rend As GridComboBoxCellRenderer = TryCast(gridControl1.CurrentCell.Renderer, GridComboBoxCellRenderer)    Dim list As ListBox = rend.ListBoxPart    If list.Items.Count=0 Then    MessageBox.Show("ComboBox is Empty")    End If End Sub   Screenshot   Sample links: C# DropDownComboBox_CS VB DropDownComboBox_VB Conclusion I hope you enjoyed learning about how to implement an excel accounting format in the syncfusion WinForms GridControl. You can refer to our WinForms GridControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridControl documentation to understand how to present and manipulate data. For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridControl and other WinForms components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!  
How to change the header cell color in WinForms GridGroupingControl?
Change the header cell color The back color of the column header cell can be changed by setting the Themed property of header style to False in QueryCellStyleInfo event. C# this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);   void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) {    if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.Name == "CategoryID" && e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)    {       e.Style.Themed = false;       e.Style.BackColor = Color.Blue;    } } VB AddHandler gridGroupingControl1.QueryCellStyleInfo, AddressOf gridGroupingControl1_QueryCellStyleInfo   Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)    If e.TableCellIdentity.Column IsNot Nothing AndAlso e.TableCellIdentity.Column.Name = "CategoryID" AndAlso e.TableCellIdentity.TableCellType = GridTableCellType.ColumnHeaderCell Then      e.Style.Themed = False      e.Style.BackColor = Color.Blue    End If End Sub   Samples: C#: ChangeHeaderColor_CS VB: ChangeHeaderColor_VB
Why check box is not working fine in WinForms GridControl?
Cell value type The Boolean CellValueType, the check box selection will not work properly. The check mark will be enabled only after 2 clicks with the following code, C# gridControl1[rowIndex, CheckBoxColumnIndex].CellValueType = typeof(bool);   VB gridControl1(rowIndex, CheckBoxColumnIndex).CellValueType = GetType(Boolean)   Solution This issue can be resolved by handling the intermediate option through the CheckBoxOptions property. Pass flateLook value as true to draw the flat checkbox, otherwise false. C# gridControl1[rowIndex, CheckBoxColumnIndex].CheckBoxOptions = new GridCheckBoxCellInfo("true", "false", "indeterminate", true);   VB gridControl1(rowIndex, CheckBoxColumnIndex).CheckBoxOptions = New GridCheckBoxCellInfo("true", "false", "indeterminate", True)   Samples: C#: CheckBox_C# VB: CheckBox_VB Reference link: https://help.syncfusion.com/windowsforms/grid-control/enhanced-cell-typesConclusionI hope you enjoyed learning on why the check box is not working fine when the CellValueType is set to bool in WinForms GridControl.You can refer to our WinForms Grid feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to present and manipulate data.For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our ASP.NET MVC Chart and other ASP.NET MVC components.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to set image in dropdown GridListControl cell in WinForms GridGroupingControl?
Images in dropdown In GridGroupingControl, you can set the images for dropdown GridListControl by handling the TableControlCurrentCellShowingDropDown to get the GridListControl dropdown and PrepareViewStyleInfo event of dropdown GridListControl to set the images.   C# //Event subscription this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += gridGroupingControl1_TableControlCurrentCellShowingDropDown;   //Handling the PrepareViewStyleInfo event void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e) {     if ((e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent is GridDropDownGridListControlCellRenderer))     {         (e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent as GridDropDownGridListControlCellRenderer).ListControlPart.ShowColumnHeader = false;         //Event subscription.         (e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent as GridDropDownGridListControlCellRenderer).ListControlPart.Grid.PrepareViewStyleInfo += Grid_PrepareViewStyleInfo;     } }   //Set the images in DropDown GridListControl private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) {     if (e.ColIndex == 1)     {         e.Style.ImageList = imageList2;         if (e.RowIndex > 0)             e.Style.ImageIndex = (e.RowIndex - 1) % imageList2.Images.Count;     } }   VB 'Event subscription Private Me.gridGroupingControl1.TableControlCurrentCellShowingDropDown += AddressOf gridGroupingControl1_TableControlCurrentCellShowingDropDown   'Handling the PrepareViewStyleInfo event Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs)       If (TypeOf e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent Is GridDropDownGridListControlCellRenderer) Then          TryCast(e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent, GridDropDownGridListControlCellRenderer).ListControlPart.ShowColumnHeader = False             'Event subscription.             AddHandler TryCast(e.TableControl.CurrentCell.Renderer.DropDownContainer.PopupParent, GridDropDownGridListControlCellRenderer).ListControlPart.Grid.PrepareViewStyleInfo, AddressOf Grid_PrepareViewStyleInfo       End If End Sub   'Set the images in DropDown GridListControl Private Sub Grid_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs)       If e.ColIndex = 1 Then             e.Style.ImageList = imageList2             If e.RowIndex > 0 Then                     e.Style.ImageIndex = (e.RowIndex - 1) Mod imageList2.Images.Count             End If       End If End Sub Screenshot Samples: C#: Images_In_DropDown VB: Images_In_DropDown
How to show combobox dropdown on entering textin WinForms Grid?
Combobox customization To show the ComboBox dropdown on entering the text in cell, TableControlCurrentCellKeyPress event can be used and CurrentCell.ShowDropDown property can be used in that event. The Autocomplete option can be enabled by using AutoCompleteInEditMode property. C# //Assigning the column cell types as GridListControl this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;   //Enables Autocomplete this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AnyRecordFieldCell.AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest;   //Triggering Event this.gridGroupingControl1.TableControlCurrentCellKeyPress += gridGroupingControl1_TableControlCurrentCellKeyPress;   //Handling Event void gridGroupingControl1_TableControlCurrentCellKeyPress(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyPressEventArgs e) {    if (!e.TableControl.CurrentCell.IsDroppedDown)    {       e.TableControl.CurrentCell.ShowDropDown();    } }   VB 'Assigning the column cell types as GridListControl.          Private Me.gridGroupingControl1.TableDescriptor.Columns("Description").Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl   'Enables Autocomplete           Private Me.gridGroupingControl1.TableDescriptor.Columns("Description").Appearance.AnyRecordFieldCell.AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest   'Triggering Event Private Me.gridGroupingControl1.TableControlCurrentCellKeyPress += AddressOf gridGroupingControl1_TableControlCurrentCellKeyPress   'Handling Event Private Sub gridGroupingControl1_TableControlCurrentCellKeyPress(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyPressEventArgs)    If Not e.TableControl.CurrentCell.IsDroppedDown Then       e.TableControl.CurrentCell.ShowDropDown()    End If End Sub   Screenshot Samples: C#: ComboBox Dropdown CS VB: ComboBox Dropdown VB ConclusionI hope you enjoyed learning on how to show the combobox dropdown on entering a text in cell in WinForms GridGroupingControl.You can refer to our WinForms Grid feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to present and manipulate data.For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our ASP.NET MVC Chart and other ASP.NET MVC components.If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to display a image and text in a cell in GridControl?
The grid does not have the build in support of image with text cell type. It can be achieved by creating the custom cell renderer and cell model. For more information about to create custom cell model and renderer, refer this article.  Creating GridCellButton Code snippet C# public class ImagewithTextCell : GridCellButton {     public Image image = null;     public ImagewithTextCell(GridCellRendererBase control)         : base(control)     { }       //Draw the image after the text by calculating the text width.     public override void Draw(Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style)     {         Point pt = Point.Empty;         Rectangle bound = Rectangle.FromLTRB(base.Bounds.Left, base.Bounds.Top, base.Bounds.Right, base.Bounds.Bottom);         Bitmap bmp = this.image as Bitmap;         int textWidth = (int)g.MeasureString(style.Text, style.GdipFont).Width;         Rectangle r = this.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex));         if (textWidth > r.Width - bound.Width)         {             g.DrawImage(image, bound.X, bound.Y);         }         else         {             //Draw the image after the text             g.DrawImage(image, r.X + textWidth + 3, r.Y + 2);         }     } }   VB Public Class ImagewithTextCell     Inherits GridCellButton     Public image As Image = Nothing     Public Sub New(ByVal control As GridCellRendererBase)         MyBase.New(control)     End Sub       'Draw the image after the text by calculating the text width.     Public Overrides Sub Draw(ByVal g As Graphics, ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal bActive As Boolean, ByVal style As GridStyleInfo)         Dim pt As Point = Point.Empty         Dim bound As Rectangle = Rectangle.FromLTRB(MyBase.Bounds.Left, MyBase.Bounds.Top, MyBase.Bounds.Right, MyBase.Bounds.Bottom)         Dim bmp As Bitmap = TryCast(Me.image, Bitmap)         Dim textWidth As Integer = CInt(Fix(g.MeasureString(style.Text, style.GdipFont).Width))         Dim r As Rectangle = Me.Grid.RangeInfoToRectangle(GridRangeInfo.Cell(rowIndex, colIndex))         If textWidth > r.Width - bound.Width Then             g.DrawImage(image, bound.X, bound.Y)         Else             'Draw the image after the text             g.DrawImage(image, r.X + textWidth + 3, r.Y + 2)         End If     End Sub End Class   Creating CellModel Code snippet C# //Cell model public class ImagewithCellModel : GridTextBoxCellModel {     protected ImagewithCellModel(SerializationInfo info, StreamingContext context)         : base(info, context)     {     }       public ImagewithCellModel(GridModel grid)         : base(grid)     {           AllowFloating = false;         ButtonBarSize = new Size(20, 20);     }       public override GridCellRendererBase CreateRenderer(GridControlBase control)     {         return new ImagewithTextCellRenderer(control, this);     } }   VB 'Cell model Public Class ImagewithCellModel     Inherits GridTextBoxCellModel     Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)         MyBase.New(info, context)     End Sub       Public Sub New(ByVal grid As GridModel)         MyBase.New(grid)           AllowFloating = False         ButtonBarSize = New Size(20, 20)     End Sub       Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase         Return New ImagewithTextCellRenderer(control, Me)     End Function End Class   Creating CellRenderer Code snippet C# //Cell renderer public class ImagewithTextCellRenderer : GridTextBoxCellRenderer {     ImagewithTextCell mybutton;       public ImagewithTextCellRenderer(GridControlBase grid, GridCellModelBase cellModel)         : base(grid, cellModel)     {         mybutton = new ImagewithTextCell(this);         AddButton(mybutton);     }       public override void Draw(Graphics g, Rectangle cellRectangle, int rowIndex, int colIndex, GridStyleInfo style)     {         if (style.ImageList != null && style.ImageIndex >= 0)         {             this.mybutton.image = style.ImageList.Images[style.ImageIndex];             style.ImageList = null;         }         base.Draw(g, cellRectangle, rowIndex, colIndex, style);     } }   VB 'Cell renderer Public Class ImagewithTextCellRenderer     Inherits GridTextBoxCellRenderer     Private mybutton As ImagewithTextCell       Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)     MyBase.New(grid, cellModel)         mybutton = New ImagewithTextCell(Me)         AddButton(mybutton)     End Sub       Public Overrides Sub Draw(ByVal g As Graphics, ByVal cellRectangle As Rectangle, ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal style As GridStyleInfo)         If style.ImageList IsNot Nothing AndAlso style.ImageIndex >= 0 Then             Me.mybutton.image = style.ImageList.Images(style.ImageIndex)             style.ImageList = Nothing         End If            MyBase.Draw(g, cellRectangle, rowIndex, colIndex, style)     End Sub End Class   Adding CellModel and Assigning CellType Code snippet C# //Register the custom cell model this.gridControl1.Model.CellModels.Add("TextWithImageCell", new ImagewithCellModel(this.gridControl1.Model));   //Set the cell type as TextImageCell gridControl1[4, 2].CellType = "TextWithImageCell";   VB 'Register the custom cell model Me.gridControl1.Model.CellModels.Add("TextWithImageCell", New ImagewithCellModel(Me.gridControl1.Model))   'Set the cell type as TextImageCell gridControl1(4, 2).CellType = "TextWithImageCell"       Screenshot   Sample Link: C#: Display image with text CS VB: Display image with text VB
How to change the datasource for combobox cell dynamically in WinForms GridGroupingControl?
Combobox customization By default, particular cell style cannot be changed at run time for the WinForms GridGroupingControl without using QueryCellStyleInfo event. So, the datasource of the particular cell cannot be changed on run time. In order to change the data source of the ComboBoxCell based on the text typed in the cell dynamically, custom cell renderer and cell model which is derived from ComboBoxCellRenderer and ComboBoxCellModel can be used. Creating CellModel C# public class MyAutocompleTextBoxCellModel : GridComboBoxCellModel  {      public MyAutocompleTextBoxCellModel(GridModel grid)          : base(grid)      {      }      /// Creates a cell renderer.      public override GridCellRendererBase CreateRenderer(GridControlBase control)      {          return new MyAutocompleteTextBoxCellRenderer(control, this);      }  }    VB Public Class MyAutocompleTextBoxCellModel     Inherits GridComboBoxCellModel     Public Sub New(ByVal grid As GridModel)         MyBase.New(grid)     End Sub     ''' Creates a cell renderer.     Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase         Return New MyAutocompleteTextBoxCellRenderer(control, Me)     End Function End Class   Creating CellRenderer C# public class MyAutocompleteTextBoxCellRenderer : GridComboBoxCellRenderer {     GridStyleInfo cellStyle = null;     public MyAutocompleteTextBoxCellRenderer(GridControlBase grid, GridCellModelBase cellModel)         : base(grid, cellModel)     {         this.RemoveButton(this.DropDownButton);         cellStyle = GridStyleInfo.Default;     }     Hashtable styleCollection = new Hashtable();     protected override void OnSetControlText(string text)     {         if (text == "Desc6")         {             if (!styleCollection.ContainsKey(GridRangeInfo.Cell(this.RowIndex, this.ColIndex)))             {                 GridStyleInfo style = GridStyleInfo.Empty;                 style.CopyFrom(this.StyleInfo);                 DataTable table = new DataTable();                 table.Columns.Add("Description");                 table.Columns.Add("Desc ID");                 table.Rows.Add("Desc1", 1);                 table.Rows.Add("Desc2", 2);                 table.Rows.Add("Desc3", 3);                 style.DataSource = table;                 style.DisplayMember = "Description";                 style.ValueMember = "Desc ID";                 styleCollection.Add(GridRangeInfo.Cell(this.RowIndex, this.ColIndex), style);             }         }         base.OnSetControlText(text);     }       protected override void OnKeyPress(KeyPressEventArgs e)     {         this.Grid.CurrentCell.ShowDropDown();         base.OnKeyPress(e);     }       public override void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e)     {         base.OnPrepareViewStyleInfo(e);         if (styleCollection.Contains(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)))         {             GridStyleInfo modifiedStyle = ((GridStyleInfo)styleCollection[GridRangeInfo.Cell(e.RowIndex, e.ColIndex)]);             e.Style.DataSource = modifiedStyle.DataSource;             e.Style.DisplayMember = modifiedStyle.DisplayMember;             e.Style.ValueMember = modifiedStyle.ValueMember;         }     } }   VB Public Class MyAutocompleteTextBoxCellRenderer     Inherits GridComboBoxCellRenderer     Private cellStyle As GridStyleInfo = Nothing       Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)         MyBase.New(grid, cellModel)         Me.RemoveButton(Me.DropDownButton)         cellStyle = GridStyleInfo.Default     End Sub     Private styleCollection As New Hashtable()     Protected Overrides Sub OnSetControlText(ByVal text As String)         If text = "Desc6" Then             If Not styleCollection.ContainsKey(GridRangeInfo.Cell(Me.RowIndex, Me.ColIndex)) Then                 Dim style As GridStyleInfo = GridStyleInfo.Empty                 style.CopyFrom(Me.StyleInfo)                 Dim table As New DataTable()                 table.Columns.Add("Description")                 table.Columns.Add("Desc ID")                 table.Rows.Add("Desc1", 1)                 table.Rows.Add("Desc2", 2)                 table.Rows.Add("Desc3", 3)                 style.DataSource = table                 style.DisplayMember = "Description"                 style.ValueMember = "Desc ID"                 styleCollection.Add(GridRangeInfo.Cell(Me.RowIndex, Me.ColIndex), style)             End If         End If         MyBase.OnSetControlText(text)     End Sub       Protected Overrides Sub OnKeyPress(ByVal e As KeyPressEventArgs)         Me.Grid.CurrentCell.ShowDropDown()         MyBase.OnKeyPress(e)     End Sub       Public Overrides Sub OnPrepareViewStyleInfo(ByVal e As GridPrepareViewStyleInfoEventArgs)         MyBase.OnPrepareViewStyleInfo(e)         If styleCollection.Contains(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)) Then             Dim modifiedStyle As GridStyleInfo = (CType(styleCollection(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)), GridStyleInfo))             e.Style.DataSource = modifiedStyle.DataSource             e.Style.DisplayMember = modifiedStyle.DisplayMember             e.Style.ValueMember = modifiedStyle.ValueMember         End If     End Sub End Class   Adding CellModel and Assigning CellType C# //Adding CellModel this.gridGroupingControl1.TableModel.CellModels.Add("AutocompleteText", newMyAutocompleTextBoxCellModel(this.gridGroupingControl1.TableModel));    //Assigning CellType this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AnyRecordFieldCell.CellType = "AutocompleteText";   VB 'Adding CellModel Me.gridGroupingControl1.TableModel.CellModels.Add("AutocompleteText", newMyAutocompleTextBoxCellModel(Me.gridGroupingControl1.TableModel))   'Assigning CellType Me.gridGroupingControl1.TableDescriptor.Columns("Description").Appearance.AnyRecordFieldCell.CellType = "AutocompleteText"   Screenshot   Samples: C#: ComboBox Cell Datasource CS VB: ComboBox Cell Datasource VBConclusionI hope you enjoyed learning about how to change the datasource for combobox cell dynamically in WinForms GridGroupingControl.You can refer to our  WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to use a PushButton in a cell and catch the user clicking it in WinForms GridGroupingControl?
Use the CellType property to set a PushButton in a cell, and use the TableControlPushButtonClick event to get the button click action. C# //To set PushButton. this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AddNewRecordFieldCell.CellType = GridCellTypeName.PushButton; this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AddNewRecordFieldCell.Description = "PushButton"; //Event Subscription this.gridGroupingControl1.TableControlPushButtonClick += new GridTableControlCellPushButtonClickEventHandler(gridGroupingControl1_TableControlPushButtonClick); //Event Customization void gridGroupingControl1_TableControlPushButtonClick(object sender, GridTableControlCellPushButtonClickEventArgs e) {     string s = string.Format("You clicked ({0},{1}).", e.Inner.RowIndex, e.Inner.ColIndex);     MessageBox.Show(s); } VB 'To set PushButton. Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AddNewRecordFieldCell.CellType = GridCellTypeName.PushButton Me.gridGroupingControl1.TableDescriptor.Columns(2).Appearance.AddNewRecordFieldCell.Description = "PushButton" 'Event subscription AddHandler gridGroupingControl1.TableControlPushButtonClick, AddressOf gridGroupingControl1_TableControlPushButtonClick   'Event Customization Private Sub gridGroupingControl1_TableControlPushButtonClick(ByVal sender As Object, ByVal e As GridTableControlCellPushButtonClickEventArgs)  Dim s As String = String.Format("You clicked ({0},{1}).", e.Inner.RowIndex, e.Inner.ColIndex)  MessageBox.Show(s) End Sub View sample in GitHub  
How to add ComboBox for particular column in WinForms GridGroupingControl?
Add combobox for particular column In order to have a combo box in a specified column in WinForms GridGroupingControl, the required column name should be assigned the cell type as ComboBox. This can be done by changing the column’s Appearance through the TableDescriptor property. C# // form() // Specify the Column name to add the combo box. this.gridGroupingControl1.TableDescriptor.Columns["CategoryID"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox;   StringCollection list = new StringCollection(); list.Add("Quartz"); list.Add("Ruby"); list.Add("Saphire"); list.Add("Emerald"); list.Add("Diamond"); list.Add("Graphite");   // Specify the required list to be displayed in the drop down. this.gridGroupingControl1.TableDescriptor.Columns["Description"].Appearance.AnyRecordFieldCell. ChoiceList = list; VB ‘Form() ' Specify the Column name to add the combo box. Me.gridGroupingControl1.TableDescriptor.Columns("Description").Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox   Dim list As New StringCollection()  list.Add("Quartz") list.Add("Ruby") list.Add("Saphire") list.Add("Emerald") list.Add("Diamond") list.Add("Graphite")   ' Specify the required list to be displayed in the drop down. Me.gridGroupingControl1.TableDescriptor.Columns("Description").Appearance. AnyRecordFieldCell.ChoiceList = list Screenshot Samples: C#: ComboBox_CS VB: ComboBox_VB Conclusion I hope you enjoyed learning about how to add ComboBox for particular column in WinForms GridGroupingControl. You can refer to our WinForms Grid Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Grid Control documentation to understand how to present and manipulate data.  For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Grid Control and other WinForms components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!  
How to add custom control to a column in the WinForms GridGroupingControl?
  Custom control In order to add custom control to a column of the GridGroupingControl, you can set the CellType property as Control and value of that control can be set to HTMLUIControl. C# Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl htmluiControl1=new Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl(); //Set the column cell type as the html control. GridColumnDescriptor column1 = this.gridGroupingControl1.TableDescriptor.GetColumnDescriptor("Column");//Specify your Column name column1.Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Control; column1.Appearance.AnyRecordFieldCell.Control = htmluiControl1; VB Dim htmluiControl1 As New Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl() 'Set the column cell type as the html control. Dim column1 As GridColumnDescriptor = Me.gridGroupingControl1.TableDescriptor.GetColumnDescriptor("Column") 'Specify your Column name column1.Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Control column1.Appearance.AnyRecordFieldCell.Control = htmluiControl1   Samples: C#: CustomControl_CS VB: CustomControl_VB  
How to set Hex formatting of integer cell in WinForms GridControl?
Integer format as hex decimal As per WinForms Grid Control architecture the hex decimal format like {0x{0:X4} cannot be assigned by using Format property. As we have used IFormattable interface to convert the format to string, the format has to be converted from String.Format method. In the below sample, HexDecimal format to the integer cell has been set using the QueryCellInfo event. C# this.gridControl1.QueryCellInfo += new GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo); void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) {    if (e.ColIndex == 3 && e.RowIndex>0)    {        e.Style.Text = string.Format("0x{0:X4}", 255);    } }   VB Private Me.gridControl1.QueryCellInfo += New GridQueryCellInfoEventHandler(AddressOf gridControl1_QueryCellInfo) Private Sub gridControl1_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)    If e.ColIndex = 3 AndAlso e.RowIndex>0 Then     e.Style.Text = String.Format("0x{0:X4}", 255)    End If End Sub     Conclusion I hope you enjoyed learning about how to set Hex formatting of integer cell in WinForms GridControl. You can refer to our  WinForms Grid Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Grid Control documentation to understand how to present and manipulate data.  For current customers, you can check out our WinForms from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Grid Control and other WinForms components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!  
How to customize the calendar cell type in WinForms GridControl?
Customize the calendar cell type GridControl does not have DateTimePicker CellType. To set the DateTimePicker cell type, you can create a custom cell model/renderer that implements the DateTimePicker CellType and the style of the DateTimePicker can be customized using the renderer. Creating CellModel C# public class DateTimeCellModel : GridStaticCellModel {    public DateTimeCellModel (GridModel grid)          : base(grid)    {      }    public override GridCellRendererBase CreateRenderer(GridControlBase control)    {       return new DateTimeCellRenderer(control, this);    } }   VB Public Class DateTimeCellModel  Inherits GridStaticCellModel    Public Sub New(ByVal grid As GridModel)     MyBase.New(grid)    End Sub      Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase    Return New DateTimeCellRenderer(control, Me)    End Function End Class   Creating CellRenderer In the custom cell renderer constructor, the customization of the cell is achieved. C# public class DateTimeCellRenderer : GridStaticCellRenderer {    private MyDateTimePicker dateTimePicker;      public DateTimeCellRenderer(GridControlBase grid, GridCellModelBase cellModel)   : base(grid, cellModel)    {  dateTimePicker = new MyDateTimePicker();        dateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;  dateTimePicker.ShowUpDown = false;  dateTimePicker.ShowCheckBox = false;  dateTimePicker.ShowDropButton = true;  dateTimePicker.Border3DStyle = Border3DStyle.Flat;  grid.Controls.Add(dateTimePicker);    //show & hide to make sure it is initialized properly for the first use...  dateTimePicker.Show();  dateTimePicker.Hide();        Grid.HScrollBar.ValueChanged += new EventHandler(HScrollBar_ValueChanged);        Grid.VScrollBar.ValueChanged += new EventHandler(VScrollBar_ValueChanged);     }       void HScrollBar_ValueChanged(object sender, EventArgs e)     {         int row, col;         Grid.PointToRowCol(dateTimePicker.Location, out row, out col);         if (!Grid.ViewLayout.VisibleCellsRange.IntersectsWith(GridRangeInfo.Cell(row, col)) ||   (row <= this.Grid.Model.Rows.HeaderCount) || !(row.Equals(RowIndex) && col.Equals(ColIndex)))         {            this.dateTimePicker.Hide();            this.dateTimePicker.ShowDropButton = false;         }         else         {            this.dateTimePicker.Show();            this.dateTimePicker.ShowDropButton = true;         }    }      void VScrollBar_ValueChanged(object sender, EventArgs e)    {       int row, col;       Grid.PointToRowCol(dateTimePicker.Location, out row, out col);       if (!Grid.ViewLayout.VisibleCellsRange.IntersectsWith(GridRangeInfo.Cell(row, col)) || (row <= this.Grid.Model.Rows.HeaderCount) || !(row.Equals(RowIndex) && col.Equals(ColIndex)))       {           this.dateTimePicker.Hide();           this.dateTimePicker.ShowDropButton = false;      }      else      {         this.dateTimePicker.Show();         this.dateTimePicker.ShowDropButton = true;       }    } }   VB Public Class DateTimeCellRenderer  Inherits GridStaticCellRenderer    Private dateTimePicker As MyDateTimePicker      Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)     MyBase.New(grid, cellModel)  dateTimePicker = New MyDateTimePicker()    dateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom  dateTimePicker.ShowUpDown = False  dateTimePicker.ShowCheckBox = False  dateTimePicker.ShowDropButton = True  dateTimePicker.Border3DStyle = Border3DStyle.Flat  grid.Controls.Add(dateTimePicker)    'show & hide to make sure it is initialized properly for the first use...  dateTimePicker.Show()  dateTimePicker.Hide()     AddHandler Grid.HScrollBar.ValueChanged, AddressOf HScrollBar_ValueChanged     AddHandler Grid.VScrollBar.ValueChanged, AddressOf VScrollBar_ValueChanged    End Sub      Private Sub HScrollBar_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)       Dim row, col As Integer       Grid.PointToRowCol(dateTimePicker.Location, row, col)       If (Not Grid.ViewLayout.VisibleCellsRange.IntersectsWith(GridRangeInfo.Cell(row, col))) OrElse (row <= Me.Grid.Model.Rows.HeaderCount) OrElse Not(row.Equals(RowIndex) AndAlso col.Equals(ColIndex)) Then         Me.dateTimePicker.Hide()         Me.dateTimePicker.ShowDropButton = False       Else          Me.dateTimePicker.Show()          Me.dateTimePicker.ShowDropButton = True       End If    End Sub      Private Sub VScrollBar_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)        Dim row, col As Integer        Grid.PointToRowCol(dateTimePicker.Location, row, col)         If (Not Grid.ViewLayout.VisibleCellsRange.IntersectsWith(GridRangeInfo.Cell(row, col))) OrElse (row <= Me.Grid.Model.Rows.HeaderCount) OrElse Not(row.Equals(RowIndex) AndAlso col.Equals(ColIndex)) Then            Me.dateTimePicker.Hide()            Me.dateTimePicker.ShowDropButton = False        Else            Me.dateTimePicker.Show()            Me.dateTimePicker.ShowDropButton = True        End If    End Sub End Class   Adding CellModel and Assigning CellType C# //Adding CellModel this.gridControl1.CellModels.Add("DateTimePicker", new DateTimeCellModel(this.gridControl1.Model));   //Assigning CellType this.gridControl1[rowIndex, colIndex].CellType = "DateTimePicker";     VB 'Adding CellModel Me.gridControl1.CellModels.Add("DateTimePicker", New DateTimeCellModel(Me.gridControl1.Model))   'Assigning CellType Me.gridControl1(rowIndex, colIndex).CellType = "DateTimePicker"      
How to display the selected item at the top of the dropdown?
In order to display the highlighted choice at top of the drop down, CurrentCellKeyPress event and TextChanged event of GridComboBoxCellRenderer’s TextBox can be used. The top row index of the drop down list as the selected index can be set in the TextChanged event.   Code Snippet C#   VB   Sample Links C#: Highlight at Top_CS VB: Highlight at Top_VB  
How to show GIF images in cell with PictureBox control in WinForms GridGroupingControl?
Show GIF images in cell In order to insert an image in a cell as PictureBox control, you can set the CellType property as Control and PictureBox control can be added to the cell by using Control property. C# this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;   void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e) {    if (e.TableCellIdentity.ColIndex == 2 && e.TableCellIdentity.RowIndex != 1)    {       if (e.Style.Text == "Image0")       {          e.Style.CellType = GridCellTypeName.Control;          e.Style.Control = p1;       }       if (e.Style.Text == "Image1")       {          e.Style.CellType = GridCellTypeName.Control;          e.Style.Control = p2;       }       if (e.Style.Text == "Image2")       {          e.Style.CellType = GridCellTypeName.Control;          e.Style.Control = p3;       }       if (e.Style.Text == "Image3")       {          e.Style.CellType = GridCellTypeName.Control;          e.Style.Control = p4;       }    } }   VB Private Me.gridGroupingControl1.QueryCellStyleInfo += AddressOf gridGroupingControl1_QueryCellStyleInfo   Private Sub gridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs)    If e.TableCellIdentity.ColIndex = 2 AndAlso e.TableCellIdentity.RowIndex <> 1 Then       If e.Style.Text = "Image0" Then          e.Style.CellType = GridCellTypeName.Control          e.Style.Control = p1       End If       If e.Style.Text = "Image1" Then          e.Style.CellType = GridCellTypeName.Control          e.Style.Control = p2       End If       If e.Style.Text = "Image2" Then          e.Style.CellType = GridCellTypeName.Control          e.Style.Control = p3       End If       If e.Style.Text = "Image3" Then          e.Style.CellType = GridCellTypeName.Control          e.Style.Control = p4       End If    End If End Sub  
How to align button at the centre of a cell?
In order to align the button at the center of grid cell, the customized cell model and cell renderer of the button can be used. Then override the OnLayout() method to specify the bounds of the button to align at center. Code Snippet Defining the custom cell model C# public class SampleButtonCellModel : GridStaticCellModel {    protected SampleButtonCellModel(SerializationInfo info, StreamingContext context)              : base(info, context)    {    }    public SampleButtonCellModel(GridModel grid)           : base(grid)    {        AllowFloating = false;        ButtonBarSize = new Size(120, 120);    }      public override GridCellRendererBase CreateRenderer(GridControlBase control)    {        return new SampleButtonCellRenderer(control, this);    } }   VB Public Class SampleButtonCellModel  Inherits GridStaticCellModel    Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)     MyBase.New(info, context)    End Sub    Public Sub New(ByVal grid As GridModel)     MyBase.New(grid)    AllowFloating = False    ButtonBarSize = New Size(120, 120)    End Sub      Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase    Return New SampleButtonCellRenderer(control, Me)    End Function End Class     Defining custom cell renderer C# public class SampleButtonCellRenderer : GridStaticCellRenderer {     protected GridCellButton sampleButton;     public SampleButtonCellRenderer(GridControlBase grid, GridCellModelBase cellModel)             : base(grid, cellModel)     {        AddButton(this.sampleButton = new GridCellButton(this));        this.ForceRefreshOnActivateCell = true;     }     protected SampleButtonCellRenderer(GridControlBase grid, GridCellModelBase cellModel, GridCellButton button)             : base(grid, cellModel)     {         this.sampleButton = button;     }     protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)     {         base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);     }       protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)     {        TraceUtil.TraceCurrentMethodInfo(rowIndex, colIndex, style, innerBounds, buttonsBounds);        Rectangle rect = GridUtil.CenterInRect(innerBounds, this.Model.ButtonBarSize);        int width = rect.Width / 2;        buttonsBounds[0] = new Rectangle(rect.X + width / 2, rect.Y, width, rect.Height);        return innerBounds;     } }   VB Public Class SampleButtonCellRenderer  Inherits GridStaticCellRenderer    Protected sampleButton As GridCellButton    Public Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase)     MyBase.New(grid, cellModel)    AddButton(Me.sampleButton = New GridCellButton(Me))    Me.ForceRefreshOnActivateCell = True    End Sub    Protected Sub New(ByVal grid As GridControlBase, ByVal cellModel As GridCellModelBase, ByVal button As GridCellButton)     MyBase.New(grid, cellModel)     Me.sampleButton = button    End Sub    Protected Overrides Sub OnDraw(ByVal g As Graphics, ByVal clientRectangle As Rectangle, ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal style As GridStyleInfo)     MyBase.OnDraw(g, clientRectangle, rowIndex, colIndex, style)    End Sub      Protected Overrides Function OnLayout(ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal style As GridStyleInfo, ByVal innerBounds As Rectangle, ByVal buttonsBounds() As Rectangle) As Rectangle     TraceUtil.TraceCurrentMethodInfo(rowIndex, colIndex, style, innerBounds, buttonsBounds)     Dim rect As Rectangle = GridUtil.CenterInRect(innerBounds, Me.Model.ButtonBarSize)     Dim width As Integer = rect.Width \ 2     buttonsBounds(0) = New Rectangle(rect.X + width \ 2, rect.Y, width, rect.Height)     Return innerBounds    End Function End Class   Adding the custom cell model C# // form() this.gridControl1.CellModels.Add("SampleButton", new SampleButtonCellModel(this.gridControl1.Model)); this.gridControl1[2, 2].CellValue = ""; this.gridControl1[2, 2].CellType = "SampleButton";   VB ' form() Me.gridControl1.CellModels.Add("SampleButton", New SampleButtonCellModel(Me.gridControl1.Model)) Me.gridControl1(2, 2).CellValue = "" Me.gridControl1(2, 2).CellType = "SampleButton"   Screenshot Sample links: C# ButtonAlignment_CS VB ButtonAlignment_VB
How to have a combination of ComboBox and ButtonEdit cell within a single Grid cell in WinForms GridControl?
Combination of ComboBox and ButtonEdit cell The combo box cell and button edit cell can be implemented by having a ComboCellModel and the ComboCellRenderer that is derived from GridComboCellModel and GridComboCellRenderer. The below link helps to guide the custom cell renderer: Custom cell renderer . The above link helps to learn about custom cell renderer, and we can learn how the cell models and cell renderer will be works. Creating Cell Model In the combo cell model, the combo cell renderer class object is invoked by a CreateRenderer() override method. C# #region combocell model class ComboCellModel : GridComboBoxCellModel { public ComboCellModel(GridModel grid)     : base(grid) {     //Set the size of the button bar.     ButtonBarSize = new System.Drawing.Size(30, 15); } public override GridCellRendererBase CreateRenderer(GridControlBase control) {     return new ComboCellRenderer(control, this); } }   VB #Region "combocell model" Friend Class ComboCellModel  Inherits GridComboBoxCellModel Public Sub New(ByVal grid As GridModel)  MyBase.New(grid)  'Set the size of the button bar.  ButtonBarSize = New System.Drawing.Size(30, 15) End Sub Public Overrides Function CreateRenderer(ByVal control As GridControlBase) As GridCellRendererBase  Return New ComboCellRenderer(control, Me) End Function End Class   Creating Cell Renderer In the combo cell renderer, the customization of the cell is achieved. The combo box button is added to ComboCellRenderer. C# #region Combocell cellRenderer class ComboCellRenderer : GridComboBoxCellRenderer { public GridCellButton button; public ComboCellRenderer(GridControlBase control, GridCellModelBase model) : base(control, model) { button = new GridCellButton(this);             //Add the button to the comboBox cell this.AddButton(button); } }   VB #Region "Combocell cellRenderer" Friend Class ComboCellRenderer  Inherits GridComboBoxCellRenderer Public button As GridCellButton Public Sub New(ByVal control As GridControlBase, ByVal model As GridCellModelBase)  MyBase.New(control, model) button = New GridCellButton(Me)   'Add the button to the comboBox cell Me.AddButton(button) End Sub     Adding Cell Models The created model (ComboCellModel) can be added into CellModels collection and the cell type name ComboBoxButtonEditCell can be defined. C# this.gridControl1.Model.CellModels.Add("ComboBoxButtonEditCell", new ComboCellModel(this.gridControl1.Model));   VB Me.gridControl1.Model.CellModels.Add("ComboBoxButtonEditCell", New ComboCellModel(Me.gridControl1.Model))   Assigning Cell type The cell type ComboBoxButtonEditCell can be assigned to a cell or range of cells using the CellType property. C# this.gridControl1[2, 3].CellType = "ComboBoxButtonEditCell";   VB Me.gridControl1(2, 3).CellType = "ComboBoxButtonEditCell"   Event for the Cell Button To trigger an event when cell button clicked, the renderer.button.Clicked event can be used. This event is coded in the cell renderer level. Likewise, any events can be added in ComboBoxButtonEditCell. C# ComboCellRenderer renderer = gridControl1.GetCellRenderer(2, 3) as ComboCellRenderer; renderer.button.Clicked += button_Clicked;                    } void button_Clicked(object sender, GridCellEventArgs e) { MessageBox.Show(String.Format("Button Edit Pressed at ({0},{1})", e.RowIndex, e.ColIndex)); }   VB Private renderer As ComboCellRenderer = TryCast(gridControl1.GetCellRenderer(2, 3), ComboCellRenderer) Private renderer.button.Clicked += AddressOf button_Clicked   } Private Sub button_Clicked(ByVal sender As Object, ByVal e As GridCellEventArgs) MessageBox.Show(String.Format("Button Edit Pressed at ({0},{1})", e.RowIndex, e.ColIndex)) End Sub   Screenshot Samples: C#: ComboBox with Button VB: ComboBox with Button Conclusion I hope you enjoyed learning about how to have a combination of ComboBox and ButtonEdit cell within a single Grid cell in WinForms GridControl. You can refer to our WinForms GridControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridControl documentation to understand how to present and manipulate data. For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridControl and other WinForms components. If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!                                                        
How to have two or more columns with column headers in a DropDown cell in WinForms GridGroupingControl?
Drop down cell To have two or more columns with column headers in a dropdown cell, the GridListControl cell type can be used. ShowColumnHeader property will be used for displaying the column headers along with the following code. C# //To add columns           GridTableCellStyleInfo styleInfo = this.gridGroupingControl1.TableDescriptor.Columns["CategoryName"].Appearance.AnyRecordFieldCell; styleInfo.DataSource = GetTable(); styleInfo.ValueMember = "ID"; styleInfo.DisplayMember = "Value"; styleInfo.CellType = "GridListControl"; GridDropDownGridListControlCellRenderer gcr1 = (GridDropDownGridListControlCellRenderer)gridGroupingControl1.TableControl.CellRenderers["GridListControl"]; gcr1.ListControlPart.ShowColumnHeader = true; styleInfo.DropDownStyle = GridDropDownStyle.AutoComplete;   VB 'To add columns           Dim styleInfo As GridTableCellStyleInfo = Me.gridGroupingControl1.TableDescriptor.Columns("CategoryName").Appearance.AnyRecordFieldCell styleInfo.DataSource = GetTable() styleInfo.ValueMember = "ID" styleInfo.DisplayMember = "Value" styleInfo.CellType = "GridListControl" Dim gcr1 As GridDropDownGridListControlCellRenderer = CType(gridGroupingControl1.TableControl.CellRenderers("GridListControl"), GridDropDownGridListControlCellRenderer) gcr1.ListControlPart.ShowColumnHeader = True styleInfo.DropDownStyle = GridDropDownStyle.AutoComplete     TableControlCurrentCellShowingDropDown event triggers when the dropdown list opened. C# this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += new GridTableControlCurrentCellShowingDropDownEventHandler(gridGroupingControl1_TableControlCurrentCellShowingDropDown);   void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e) {     GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;     if (cr != null)         ((GridDropDownGridListControlPart)cr.ListControlPart).DropDownRows = 5; }     VB Private Me.gridGroupingControl1.TableControlCurrentCellShowingDropDown += New GridTableControlCurrentCellShowingDropDownEventHandler(AddressOf gridGroupingControl1_TableControlCurrentCellShowingDropDown)   Private Sub gridGroupingControl1_TableControlCurrentCellShowingDropDown(ByVal sender As Object, ByVal e As GridTableControlCurrentCellShowingDropDownEventArgs)      Dim cr As GridDropDownGridListControlCellRenderer = TryCast(Me.gridGroupingControl1.TableControl.CurrentCell.Renderer, GridDropDownGridListControlCellRenderer)      If cr IsNot Nothing Then          CType(cr.ListControlPart, GridDropDownGridListControlPart).DropDownRows = 5      End If End Sub   Screenshot   Samples: C#: Two or more columns with column header VB: Two or more columns with column header  
How to get the cell value of DoubleTextBox from CurrentCellValidated event in WinForms GridControl?
CurrentCellValidated event To get cell value for double textbox in CurrentCellValidated event by using below code snippet. Cell type can be declared as DoubleTextBox.ToString() and also get a cell values for double textbox by using CurrentCellValidated event. C#: this.gridControl1.CurrentCellValidated += gridControl1_CurrentCellValidated; } private void gridControl1_CurrentCellValidated(object sender, EventArgs e) {     //throw new NotImplementedException();     GridCurrentCell cc = this.gridControl1.CurrentCell;     if (cc.ColIndex > 0 && cc.RowIndex > 0)     {         string value = this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue.ToString();     } }   VB: Private Me.gridControl1.CurrentCellValidated += AddressOf gridControl1_CurrentCellValidated } Private Sub gridControl1_CurrentCellValidated(ByVal sender As Object, ByVal e As EventArgs)  'throw new NotImplementedException();  Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell  If cc.ColIndex > 0 AndAlso cc.RowIndex > 0 Then   Dim value As String = Me.gridControl1(cc.RowIndex, cc.ColIndex).CellValue.ToString()  End If End Sub   Samples: C#: Double Textbox VB: Double Textbox
No articles found
No articles found
1 of 3 pages (71 items)