Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Functions in Crystal Report XI

Status
Not open for further replies.

manishjoisar

Programmer
Apr 29, 2002
52
0
0
IN
how to write custom function in Crystal
Can u give me syntax of it,

Following function i have written in VB.NET, now i want this function in Crystal Report, so i can pass two date and i get No. Of Weeks

Function (GetNoOfWeeks(ByVal sdate As Date, ByVal edate As Date)
Dim w1, w2, i As Integer

w1 = Weekday(sdate)
w2 = Weekday(edate)
sdate = DateAdd("d", 6 - w1, sdate)
edate = DateAdd("d", 6 - w2, edate)
i = 1
Do While Not DateDiff("d", sdate, edate) = 0
sdate = DateAdd("d", 7, sdate)
i = i + 1
Loop
GetNoOfWeeks = i
End Function

Is there any way i can get VB.NET functions in Crystal Reports, IN VB6 we can Named DLL With Prefix As CRUFL
so it is coming in Additional Function in VB6, but what is there for VB.NET
 
Try using the DateDiff function in CR. That will calculate the number of weeks for you. Or days, or weeks, or minutes, or whatever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top