ComponentOne GanttView for WinForms
Creating a Custom Column
GanttView for WinForms Task-Based Help > Creating a Custom Column

This topic shows how to programmatically create a custom column.

To write code in Visual Basic

Visual Basic
Copy Code
Private Sub btnAddCustomColumn_Click(sender As Object, e As EventArgs)
      Dim cc As New CustomFieldColumn()
      cc.Caption = "My Numeric Column"
      cc.DataType = GetType(Decimal)
      cc.Format = "$#0"
      cc.Name = "MyNumericColumn"
      cc.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
      cc.Width = 65
      ganttView.Columns.Add(cc) 
End Sub

To write code in C#

C#
Copy Code
private void btnAddCustomColumn_Click(object sender, EventArgs e)
{
    CustomFieldColumn cc = new CustomFieldColumn();
    cc.Caption = "My Numeric Column";
    cc.DataType = typeof(decimal);
    cc.Format = "$#0";
    cc.Name = "MyNumericColumn";
    cc.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
    cc.Width = 65;
    ganttView.Columns.Add(cc);
}
See Also