pamsauto
asked on
Extend vb.Net Class to have New Property
How do you add an new property to an existing .Net Class. What I want ot do exactlyis add a property to the dateTime class.
The goal would be like this.
Here is the code I use to get the week of the month.
The goal would be like this.
Dim intWeek as integer = DateTime.Now.WeekOfMonth
Here is the code I use to get the week of the month.
Dim DayNo As Integer = 0
Dim DateNo As Integer = 0
Dim StartingDay As Integer = 0
Dim PayPerEndDate As Date = DateTime.Now
Dim week As Integer = 1
StartingDay = PayPerEndDate.AddDays(-(PayPerEndDate.Day - 1)).DayOfWeek
DayNo = PayPerEndDate.DayOfWeek
DateNo = PayPerEndDate.Day
week = Fix(DateNo / 7)
If DateNo Mod 7 > 0 Then
week += 1
End If
If StartingDay > DayNo Then
week += 1
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very nice!