event DateChange ()
Occurs when the first visible date is changed.

 TypeDescription 
The DateChange event is fired when the first visible date is changed. Use the FirstVisibleDate property to specify the first visible date. Use the ScrollTo method to ensure that a specified date is visible. Use the FormatDate property to format a date to a specified format.

Syntax for DateChange event, /NET version, on:

private void DateChange(object sender)
{
}

Private Sub DateChange(ByVal sender As System.Object) Handles DateChange
End Sub

Syntax for DateChange event, /COM version, on:

private void DateChange(object sender, EventArgs e)
{
}

void OnDateChange()
{
}

void __fastcall DateChange(TObject *Sender)
{
}

procedure DateChange(ASender: TObject; );
begin
end;

procedure DateChange(sender: System.Object; e: System.EventArgs);
begin
end;

begin event DateChange()
end event DateChange

Private Sub DateChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateChange
End Sub

Private Sub DateChange()
End Sub

Private Sub DateChange()
End Sub

LPARAMETERS nop

PROCEDURE OnDateChange(oGantt)
RETURN

Syntax for DateChange event, /COM version (others), on:

<SCRIPT EVENT="DateChange()" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function DateChange()
End Function
</SCRIPT>

Procedure OnComDateChange 
	Forward Send OnComDateChange 
End_Procedure

METHOD OCX_DateChange() CLASS MainDialog
RETURN NIL

void onEvent_DateChange()
{
}

function DateChange as v ()
end function

function nativeObject_DateChange()
return

The following VB sample displays the first visible date when the user changes the first visible date:

Private Sub Gantt1_DateChange()
    With Gantt1.Chart
        Debug.Print FormatDateTime(.FirstVisibleDate)
    End With
End Sub

or you can use the FormatDate method like follows:

Private Sub Gantt1_DateChange()
    With Gantt1.Chart
        Debug.Print .FormatDate(.FirstVisibleDate, "<%yyyy%>-<%m%>-<%d%>")
    End With
End Sub

The following C++ sample displays the first visible date when the user changes the first visible date:

#include "Gantt.h"
#include "Chart.h"

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

void OnDateChangeGantt1() 
{
	if ( m_gantt.GetControlUnknown() )
	{
		CChart chart = m_gantt.GetChart();
		TCHAR szDate[1024] = _T("");
		SYSTEMTIME stDate = {0};
		VariantTimeToSystemTime( V2D( &chart.GetFirstVisibleDate() ), &stDate );
		GetDateFormat( LOCALE_SYSTEM_DEFAULT, LOCALE_USE_CP_ACP, &stDate, NULL, szDate, 1024 );
		OutputDebugString( szDate );
	}
}

The following VB.NET sample displays the first visible date when the user changes the first visible date:

Private Sub AxGantt1_DateChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxGantt1.DateChange
    Debug.Write(AxGantt1.Chart.FirstVisibleDate.ToString())
End Sub

The following C# sample displays the first visible date when the user changes the first visible date:

private void axGantt1_DateChange(object sender, EventArgs e)
{
	System.Diagnostics.Debug.Write(axGantt1.Chart.FirstVisibleDate.ToString());
}

The following VFP sample displays the first visible date when the user changes the first visible date:

*** ActiveX Control Event ***

with thisform.Gantt1.Chart
	wait window nowait .FormatDate(.FirstVisibleDate, "<%yyyy%>-<%m%>-<%d%>")
endwith


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