Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2145
WinGanttView - Unhandled exception
posted

Hi,

Been trying to get to grips with the Gantt view control but have been stopped in my tracks by a strange problem.

Basically when I first click on the calendar side of gantt chart when is populated I get:": '65756745' belongs to a different project than the one currently being displayed by the control, and cannot be designated as the ActiveTask." Whatever that means, as I only have one project and it's [unassinged]

If however I click on the grid side first then click the calendar it works fine.

As this is in the experimental stage I can post the code here as its still rather simple:

 

Public Class frmOffering

    Private _SQLOffering As New sqlOffering

#Region "Form events"
    Private Sub frmOffering_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        _NewOffering = False
        Dim IntervalSetup As New Infragistics.Win.UltraWinSchedule.DateInterval
        'Set up the Gantt chart.
        ugvOffering.CalendarInfo.CustomTaskColumns.Add("AimRef", GetType(String), True)
        ugvOffering.CalendarInfo.CustomTaskColumns.Add("Description", GetType(String), True)
        ugvOffering.CalendarInfo.CustomTaskColumns.Add("AimId", GetType(Integer), True)
        ugvOffering.GridSettings.ColumnSettings("AimId").Visible = False
        ugvOffering.AutoDisplayTaskDialog = Infragistics.Win.UltraWinGanttView.AutoDisplayTaskDialog.GridAreaOrChartArea
        IntervalSetup.SynchronizingDate = gsettings.getSetting("CourseStartDate")
        IntervalSetup.IntervalUnits = Infragistics.Win.UltraWinSchedule.DateIntervalUnits.Months
        ugvOffering.TimelineSettings.PrimaryInterval = IntervalSetup
        'Populate the offering combobox.
        ucmbOffering.DataSource = _SQLOffering.LoadOfferingList()
    End Sub

 
    Private Sub ucmbOffering_Leave(sender As System.Object, e As System.EventArgs) Handles ucmbOffering.Leave, ucmbOffering.AfterCloseUp
        If ucmbOffering.IsItemInList(ucmbOffering.Text) = True Then
             LoadOfferingData(ucmbOffering.Value)
        End If
    End Sub


#End Region
#Region "Internal subs"

    Private Sub LoadOfferingData(ByVal OfferingId As Integer)
        Dim dtOfferingData As New DataTable
        Dim TaskIndex As Integer = 0
        Dim atask As New Infragistics.Win.UltraWinSchedule.Task
        Dim startdate, enddate As DateTime
        Dim Duration As Integer
        'Get the tasks for the current offering.
        dtOfferingData = _SQLOffering.GetOfferingData(OfferingId)
        'clear the old tasks
        ugvOffering.CalendarInfo.Tasks.Clear()
        If IsNothing(dtOfferingData) = False Then
            'Assign all the data to the tasks.
            For Each drow As DataRow In dtOfferingData.Rows
                startdate = CDate(gsettings.getSetting("CourseStartDate")).AddMonths(drow.Item("StartMonth") - 1)
                enddate = CDate(gsettings.getSetting("CourseStartDate")).AddMonths(drow.Item("EndMonth") - 1)
                Duration = DateDiff(DateInterval.Day, startdate, enddate)
                ugvOffering.CalendarInfo.Tasks.Add(startdate, TimeSpan.FromDays(Duration), Infragistics.Win.TimeSpanFormat.Days, drow.Item("AimRef"))
                ugvOffering.CalendarInfo.Tasks(TaskIndex).SetCustomProperty("AimRef", drow.Item("AimRef"))
                ugvOffering.CalendarInfo.Tasks(TaskIndex).SetCustomProperty("Description", drow.Item("AimTitle"))
                ugvOffering.CalendarInfo.Tasks(TaskIndex).SetCustomProperty("AimId", drow.Item("AimId"))
                TaskIndex += 1
            Next
     'Added the below to try and stop the error but it still happens
            'ugvOffering.ActiveTask = ugvOffering.CalendarInfo.Tasks(TaskIndex - 1)
        End If
    End Sub


#End Region

 

 

 


 

 

 

End Class

 

 

Finally, Is it possible to have custom column styles in the grid such as drop downs and buttons, or can I just make a grid and assign it to the control, as the grid that is included is rather restriced.

 

Thanks

 

Alex