locked
Custom code doesn't run correctly when printing RRS feed

  • Question

  • User-1103829401 posted

    I have a windows form application I upgrade from VS2005 to VS2010. This application included RDLC files that include custom code used to track summary calculations. This all worked correctly in 2005 but no longer works correctly when printing in 2010. It displays fine when viewing in the ReportViewer but once you print then it puts seemingly random values out. The code is pretty simple, I just can't figure out what the difference is between viewing in the ReportViewer and printing.

    Friend Shared dat_Start As Date
    Friend Shared int_Total As Int64
    Friend Shared int_Person as Int64
    
    Protected Overrides Sub OnInit()
    	int_Total = 0
    	int_Person = 0
    	dat_Start = #1/1/1000#
    End Sub
    
    Function CalcHours(ByVal str_Status As String, ByVal dat_Date As DateTime) As Double
    	Select Case str_Status
    		Case "No Shift"
    			int_Total = 0
    			int_Person = 0
    			Return 0
    		Case "In"
    			dat_Start = dat_Date
    			Return 0
    		Case "Out"
    			Dim int_Calc as Int64 = DateDiff(DateInterval.Second, dat_Start, dat_Date)
    			int_Total = int_Total + int_Calc
    			int_Person = int_Person + int_Calc
    			Return int_Total
    			Case Else
    		Return 0
    	End Select
    End Function
    
    Function TimeString(ByVal iSeconds As Int64) As String
    	Dim ts As TimeSpan = TimeSpan.FromSeconds(iSeconds)
    	Dim iHours as Integer = ts.Hours
    	Dim iDays as Integer
    	if ts.Days >0 Then
    		iDays = ts.Days * 24
    		iHours = iHours + iDays
    	End If
    	Dim s As String = iHours.ToString("00") & ":" &  ts.Minutes.ToString("00") & ":" &  ts.Seconds.ToString("00") & " (" & FormatNumber(ts.TotalHours,2) & ")"
    	Return s
    End Function
    
    Function PullValue() As Int64
    	Dim iReturn as Int64 = int_Total
    	dat_Start = #1/1/1000#
    	int_Total = 0
    	Return iReturn
    End Function
    
    Function PullTotal() As Int64
    	Dim iReturn as Int64 = int_Person 
    	int_Person = 0
    	Return iReturn
    End Function
    Tuesday, November 15, 2011 4:28 PM

All replies