property Chart.NextDate (Date as Date, Unit as UnitEnum, [Count as Variant]) as Date
Gets the next date based on the unit.

 TypeDescription 
   Date as Date A Date expression that indicates the start date.  
   Unit as UnitEnum An UnitEnum expression that indicates the time unit to change the date.  
   Count as Variant A long expression that indicates the number of time units  
   Date A Date expression that indicates the result.  
Use the NextDate property to retrieve the next or previous date giving a specified time unit. The FirstVisibleDate property indicates the first visible date in the chart. Use the ScrollTo method to ensure that a specified date fits the chart's client area. Use the FormatDate property to format a date to a specified format.

The following VB sample displays the next day as "Tue, May 31, 2005":

With G2antt1.Chart
    Debug.Print .FormatDate(.NextDate(.FirstVisibleDate, exDay, 2), "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>")
End With

The following C++ sample displays the next day as "Tue, May 31, 2005":

CChart chart = m_g2antt.GetChart();
DATE d = chart.GetNextDate( V2D( &chart.GetFirstVisibleDate() ), 4096, COleVariant( (long)1 ) );
CString strFormat = chart.GetFormatDate( d, "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>" );
OutputDebugString( strFormat );

where the V2D function converts a Variant expression to a DATE expression:

static DATE V2D( VARIANT* pvtDate )
{
	COleVariant vtDate;
	vtDate.ChangeType( VT_DATE, pvtDate );
	return V_DATE( &vtDate );
}

The following VB.NET sample displays the next day as "Tue, May 31, 2005":

With AxG2antt1.Chart
    Debug.Write(.FormatDate(.NextDate(.FirstVisibleDate, EXG2ANTTLib.UnitEnum.exDay, 2), "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>"))
End With

The following C# sample displays the next day as "Tue, May 31, 2005":

DateTime d = Convert.ToDateTime( axG2antt1.Chart.get_NextDate(Convert.ToDateTime(axG2antt1.Chart.FirstVisibleDate), EXG2ANTTLib.UnitEnum.exDay, 1) );
String strFormat = axG2antt1.Chart.get_FormatDate(d, "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>");
System.Diagnostics.Debug.Write(strFormat);

The following VFP sample displays the next day as "Tue, May 31, 2005":

With thisform.G2antt1.Chart
    wait window nowait .FormatDate(.NextDate(.FirstVisibleDate, 4096, 2), "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>")
EndWith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.