Version

LastWeekNumberInYear Method

Returns the last week number for a particular year.
Syntax
'Declaration
 
Public Function LastWeekNumberInYear( _
   ByVal year As Integer _
) As Integer
public int LastWeekNumberInYear( 
   int year
)

Parameters

year
Year

Return Value

Integer indicating the last possible week number based on the current WeekRule and FirstDayOfWeekResolved.
Remarks

Note, this may not be the Week that contains the last day(s) of the year depending on the WeekRule and FirstDayOfWeekResolved.

Example
This example uses the LastWeekNumberInYear method to obtain the number of the last week in the current year.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
Imports System.Globalization

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

        '	Get the week number of the last week in the current year
        Dim lastWeekNumberInYear As Integer
        lastWeekNumberInYear = Me.ultraCalendarInfo1.LastWeekNumberInYear(DateTime.Today.Year)

        '	Display the information in a message box
        MessageBox.Show("The number of the last week in the current year is " + lastWeekNumberInYear.ToString(), "LastWeekNumberInYear", MessageBoxButtons.OK)

    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.IO;
using System.Globalization;

		private void button1_Click(object sender, System.EventArgs e)
		{

			//	Get the week number of the last week in the current year
			int lastWeekNumberInYear;
			lastWeekNumberInYear = this.ultraCalendarInfo1.LastWeekNumberInYear( DateTime.Today.Year );

			//	Display the information in a message box
			MessageBox.Show( "The number of the last week in the current year is " + lastWeekNumberInYear.ToString(), "LastWeekNumberInYear", MessageBoxButtons.OK );

		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also