Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click
'creating an new instance of the web service
Dim rs As New ReportingService.ReportingService
'setting the credentials to the machine that this application is running on
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
'getting the available reports
Dim items() As ReportingService.CatalogItem = rs.ListChildren("/", True)
'looping through all of the reports and writing them to the combo box (this isn't necessary!)
Dim cnt As Integer
For cnt = 0 To items.Length - 1
cmbReports.Items.Add(items(cnt).Name.ToString())
Next cnt
Dim ResultStream() As Byte
Dim StreamIdentifiers() As String
Dim OptionalParam As String = Nothing
Dim filename As String = "Test.pdf"
Dim optionalParams As ReportingService.ParameterValue() = Nothing
Dim optionalWarnings As ReportingService.Warning() = Nothing
'rendering the report as a pdf
ResultStream = rs.Render("/PATH/ReportName", "PDF", Nothing, "<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", Nothing, Nothing, Nothing, OptionalParam, OptionalParam, optionalParams, optionalWarnings, StreamIdentifiers)
'creating a file to hold the stream
Dim stream As FileStream = File.Create("C:\whatever" + filename)
'writing the stream to the file
stream.Write(ResultStream, 0, ResultStream.Length)
stream.Close()
'calling the "Postmaster" web service
Postmaster.mail()
End Sub