Re: Help code doesn't work anymore after upgading to ActiveReport 2.0
ActiveReports 2.0 (Visual Basic 6.0) Support
Help code doesn't work anymore after upgading to ActiveReport 2.0
06-18-2009, 10:31 AM
I have a section of code that dynamically builds and binds controls on a report. It used to work fine in AR1 but since upgrading to AR2 it goes into a endless loop when executing the run method on the report
%%%%%% Code Follows %%%%%%%%
With DetSection.Controls
Set ctl = .Add("DDActiveReports.Field")
ctl.Name = Prefix & "Field" & iCount
ctl.Top = iTop
ctl.Width = fld1.Width
ctl.Left = iPos
ctl.Height = fld1.Height
ctl.DataField = oField.Name
' ctl.DataSource = fld1.DataSource
ctl.OutputFormat = FormatFieldValue(oField.Type)
If IsNumericType(oField.Type) Then
ctl.Alignment = ddTXRight
ElseIf IsDateType(oField.Type) Then
ctl.Alignment = ddTXCenter
ElseIf IsDateType(oField.Type) Then
ctl.Alignment = ddTXLeft
End If
ctl.Width = CurrWidth
End With
%%%%%%%%%%%%%%%%%%%%%
I suspect it has something to do with the datacontrol being commented out. All references to DDActiveReports have been updated to DDActiveReports2. All project references to. Please help I've been chasing my tail for 2 days.
Re: Help code doesn't work anymore after upgading to ActiveReport 2.0
06-19-2009, 12:42 AM
Hello,
Thank you for your query. In order to resolve the same, please consider counting the number of fields in the datasource and adding fields accordingly. Please take a look at the attached sample in this regard.
Regards,
Prantik