Edgar Edgar - 1 month ago 14
Vb.net Question

iterating through a dataset and apply values from 5 of 7 columns to textboxs in an active report

I want to iterate through a dataSet and apply each value to a textbox in an active report. i dont know if these text boxes need to be a the Group/Header area or what. i know that my code below is only retrieving the first row. how can I iterate through all rows and apply the data to text boxes that active reports manages to get multiple rows in the group section

Private Sub rptUserCellPhoneSwap_ReportStart(sender As Object, e As System.EventArgs) Handles Me.ReportStart
Me.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Landscape
DateTxt.Text = Now.ToShortDateString & " " & Now.ToShortTimeString
Dim DataSet = GrabInformation(FirstName, LastName)
UserTxt.Text = LastName + ", " + FirstName

'For Each dr As DataRow In DataSet.Tables(0).Rows
' OldIMEITxt.Text = DataSet.Tables(0).Rows(dr("OldIMEI")).ToString
' NewIMEITxt.Text = DataSet.Tables(0).Rows(dr("NewIMEI")).ToString
' ReasonTxt.Text = DataSet.Tables(0).Rows(dr("SwapReason")).ToString
' DateRepTxt.Text = DataSet.Tables(0).Rows(dr("DateSwapped")).ToString
' ValueTxt.Text = DataSet.Tables(0).Rows(dr("EstimatedAccumulatedValue")).ToString

'Next

If Not IsNothing(DataSet) Then
If DataSet.Tables(0).Rows.Count > 0 Then
OldIMEITxt.Text = DataSet.Tables(0).Rows(0)("OldIMEI")
NewIMEITxt.Text = DataSet.Tables(0).Rows(0)("NewIMEI")
ReasonTxt.Text = DataSet.Tables(0).Rows(0)("SwapReason")
DateRepTxt.Text = DataSet.Tables(0).Rows(0)("DateSwapped")
ValueTxt.Text = DataSet.Tables(0).Rows(0)("EstimateAccumulatedValue")
End If
End If



End Sub

Answer

You can also take a look at the following pages for binding reports or changing data sources at runtime: http://arhelp.grapecity.com/webhelp/AR10/index.html#BindReportstoaDataSource.html http://arhelp.grapecity.com/webhelp/AR10/index.html#arWLKRunTimeDataSources.html

Thanks,

Mateen

GrapeCity ActiveReports Team