Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Get the cell value from a custom column in GanttView

Background:

There are two types of Columns in C1GanttVew: BaseColumn and CustomFieldColumn. To get the cell value from a BaseColumn in the Grid, you can use the Caption property of the column. Since CustomFieldColumn does not have a Caption property and only the BaseColumn properties are assigned to the grid associated with the GanttView, you would need to handle the grid’s RowColChange event and use CustomFieldColumn’s Name property in order to retrieve its cell values.

Steps to Complete:

Private Sub grid_RowColChange(sender As Object, e As EventArgs)
 Dim str As String
 Dim grid As C1FlexGrid = TryCast(sender, C1FlexGrid)
 For i As Integer = 0 To C1GanttView1.Columns.Count – 1
   If C1GanttView1.Columns(i).GetType() = New CustomFieldColumn().GetType() Then
      Dim col As CustomFieldColumn = TryCast(C1GanttView1.Columns(i), CustomFieldColumn)
//If CustomField Column Name is PROD_PART_NO
     If col.Name = "PROD_PART_NO" Then
     str = col.Caption
   End If
  End If
 Next
If grid.Row >= grid.Rows.Fixed AndAlso grid.Col >= grid.Cols.Fixed AndAlso Not grid(grid.Row, str) Is Nothing Then
  Console.WriteLine(grid(grid.Row, str))
End If
End Sub

Get the Latest Version of WinForms Edition
Download the Free Trial Now