Issue with loading report - telerik-reporting

I have designed a report using Telerik Report Designer 2013 Q3 and added it in my project folder. Now i need to load it with available parameters for the report
For that i used the code as below
Private Sub DeserialiseXmlAndGenerateReport(strFilePath As String)
Dim settings As New XmlReaderSettings()
settings.IgnoreWhitespace = True
Dim myReportBook As Telerik.Reporting.ReportBook = New Telerik.Reporting.ReportBook
Using xmlReader As System.Xml.XmlReader = System.Xml.XmlReader.Create(Server.MapPath(strFilePath), settings)
Dim xmlSerializer As New Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
Dim reportWMS As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
With reportWMS
.DocumentMapText = ""
.ReportParameters("projectNo").Value = _projectNo
.ReportParameters("dnHeaderNo").Value = _value
.ReportParameters("transferType").Value = _TransferType
ReportViewer1.DocumentMapVisible = False
ReportViewer1.ShowDocumentMapButton = False
End With
myReportBook.Reports.Add(reportWMS)
End Using
Dim reportSource = New Telerik.Reporting.InstanceReportSource
reportSource.ReportDocument = myReportBook
ReportViewer1.ReportSource = reportSource
ReportViewer1.RefreshReport()
End Sub
All the values for report parameters are supplied. But not getting any output. There is no exception fired. But a blank screen with a toolbar only gets loaded. Please help me

Related

Having Trouble Saving Report Objects From A Collection in Access 2007

So currently, I've adapted code that I got from Allen Brown to duplicate reports rather than forms. Basically I'm able to pass my criteria for the report with no problem and I can create a number of reports with the different criteria.
My problem is that each report may need to be saved, printed, or emailed to a user. But what happens is that the object that was opened first is the only thing that will be saved or emailed but when I print using the simple code DoCmd.PrintOut acPrintAll each object will take on the respective criteria. I need to figure out a way to be able to save and email these objects.
The reports are distinguishable by the HWND property that is set to it. The code I have is this currently:
Public clnClient As New Collection 'Instances of rptClient.
'Purpose: Open an independent instance of each Report with seperate criteria
Dim rpt As Report
'Open a new instance, show it, and set a caption.
If strReport = "rptInvoices" Then
Set rpt = New Report_rptInvoices
ElseIf strReport = "rptExpense" Then
Set rpt = New Report_rptExpense
ElseIf strReport = "rptExpensesDetailed" Then
Set rpt = New Report_rptExpenseDetailed
ElseIf strReport = "rptInvoicesDetailed" Then
Set rpt = New Report_rptInvoicesDetailed
ElseIf strReport = "rptPuchaseOrder" Then
Set rpt = New Report_rptPuchaseOrder
ElseIf strReport = "rptPurchaseOrderDetail" Then
Set rpt = New Report_rptPurchaseOrderDetail
ElseIf strReport = "TotalSalesForYear" Then
Set rpt = New Report_TotalSalesForYear
ElseIf strReport = "TotalShipped" Then
Set rpt = New Report_TotalShipped
ElseIf strReport = "TotalShippedDetailed" Then
Set rpt = New Report_TotalShippedDetailed
ElseIf strReport = "rptShipActual" Then
Set rpt = New Report_rptShipActual
ElseIf strReport = "rptSearchResults" Then
Set rpt = New Report_rptSearchResults
ElseIf strReport = "rptKTNA" Then
Set rpt = New Report_rptKTNA
ElseIf strReport = "rptFourWeek" Then
Set rpt = New Report_rptFourWeek
ElseIf strReport = "rptBalance" Then
Set rpt = New Report_rptBalance
ElseIf strReport = "Bosch_Report" Then
Set rpt = New Report_Bosch_Report
ElseIf strReport = "rptQuotes" Then
Set rpt = New Report_rptQuotes
End If
rpt.Visible = True
rpt.Filter = strWhereDate
rpt.FilterOn = True
rpt.Caption = rpt.Hwnd & ", opened " & Now()
rpt.txtCalledFrom = rpt.Hwnd
'Append it to our collection.
clnClient.Add Item:=rpt, Key:=CStr(rpt.Hwnd)
Set rpt = Nothing
strReport is the name of the report and strWhereDate is what is being used for the time interval. There is also code not listed here that removes the rpt.hwnd from the collection when a report closes.
The report manager that passes the criteria was adapted from Gaining Access
I'm wondering if a dictionary would work better than a collection but I've tried adapting the code and I can't seem to get it working properly, I know that dictionary's can reference objects. I've also tried this bit of code:
sRep = Screen.ActiveReport.Hwnd
DoCmd.OutputTo acOutputReport, sRep, acFormatPDF
which does accurately find the hwnd and it even opens up the dialog to save it to a location using the name hwnd.pdf but I'm afraid that it doesn't appear after you save it. I am assuming the object is technically not there?
If you try to tackle this problem, know that I'm a novice. Please help!!!

TextBox value from a form and display it to Crystal Reports using VB.NET

I created a parameter in Crystal Report named IID. But when the report loads it has nothing to display with.
This is my code :
Dim cryRpt As New rptPrntIss
cryRpt.Load("C:\Users\IEEC\Desktop\Sys\InventorySys\InventorySys\rptPrntIss.rpt")
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = frmInvntStocks.txtIID.Text
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("IID")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
You are assigning the report object to viewer and refreshing at two places. Assign the report object (cryRpt) to viewer (CrystalReportViewer1) only in the last and remove refresh in the last too. Refresh is likely to drop all your modifications to the report object i.e. any filters, parameters etc. Modify your code as below:
cryRpt.Load("C:\Users\IEEC\Desktop\Sys\InventorySys\InventorySys\rptPrntIss.rpt")
'REMOVE REPORTSOURCE AND REFRESH STATEMENTS HERE
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
and
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
'REMOVE REFRESH HERE
Report Part
Create A New Parameter 'TestParameter' on your report then put Your desire location.
VB.Net Part
now Click on Project Menu and go Your Project Propertise and click Setting then setup this format
Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowReport.Click
Dim MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument = New DailyShadeCosting
MyReport.SetParameterValue("TestParameter", TextBox6.Text)
ShowReport(MyReport, filterstring, CrystalReportViewer1)
End Sub
Public Sub ShowReport(ByVal MyReport As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal filterstring As String, ByVal CrystalReportViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer)
Dim myLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim myTable As Table
For Each myTable In MyReport.Database.Tables
myLogonInfo = myTable.LogOnInfo
myLogonInfo.ConnectionInfo.ServerName = My.Settings.RptserverPath.ToString
myLogonInfo.ConnectionInfo.DatabaseName = My.Settings.Database.ToString
myLogonInfo.ConnectionInfo.UserID = My.Settings.DBUser.ToString
myLogonInfo.ConnectionInfo.Password = My.Settings.DBPass.ToString
myTable.ApplyLogOnInfo(myLogonInfo)
Next myTable
CrystalReportViewer.ReportSource = MyReport
CrystalReportViewer.SelectionFormula = filterstring
CrystalReportViewer.Refresh()
End Sub

Programatically fill TFS New Bug workitem from VBA

I am wondering if it is possible to have VBA (Access) open a TFS Bug report webpage and fill in the description ?
While I am able to open the page I have not yet found a way to populate the description and potently other fields.
Perhaps one of the experts knows?
I wouldn't try to do what you are working on.
One, trusting a buggy application to correctly report its own bugs isn't a great idea. But beyond that you will be trying to attach Access to TFS.
That being said you can do this entirely automated. Put in some error trapping and then what you are looking to do is how to call TFS APIs. But you may or may not have to install some third part tools etc.
Starting point TFS API
The way I finally did it is to use a dll to interface between access and tfs...
For anyone trying to do the same here is the code...
Imports Microsoft.TeamFoundation.Client
Imports Microsoft.TeamFoundation.WorkItemTracking.Client
Imports Microsoft.TeamFoundation.WorkItemTracking.Common
Imports System.Runtime.InteropServices
<ComClass(TFSInterOp.ClassId, TFSInterOp.InterfaceId, TFSInterOp.EventsId)> Public Class TFSInterOp
Public Const ClassId As String = "14306fc5-1492-42d6-a032-bc4348508dd3"
Public Const InterfaceId As String = "288339cb-0c2e-45fd-8005-e5fed401f0cc"
Public Const EventsId As String = "723327dc-7777-44e4-b291-9299027665eb"
Public Sub New()
End Sub
Public Function InsertBugWorkItem(Title As String, Desc As String) As String
Dim tfsServer As String = My.Settings("TfsFullPath").ToString ' {YOUR TFS SERVER PATH}
Dim strAssUser As String = My.Settings("AssignTo").ToString
Dim teamFoundationServer1 As Microsoft.TeamFoundation.Client.TfsTeamProjectCollection = Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(New Uri(tfsServer))
Dim workItemStore1 As New WorkItemStore(teamFoundationServer1)
teamFoundationServer1.Authenticate()
Dim WorkItemStore As WorkItemStore = New WorkItemStore(tfsServer)
Dim tfsProject As Project = WorkItemStore.Projects(0)
Dim wIType As WorkItemType = tfsProject.WorkItemTypes("Bug")
Dim workItem As WorkItem = New WorkItem(wIType)
Dim wiStore = teamFoundationServer1.GetService(Of WorkItemStore)()
Dim Project = wiStore.Projects
Dim Area = Project.Item(0).AreaRootNodes("BITS").Id ' The project to add the work item to
' Prefill items
workItem.Title = Title
workItem.Description = Desc
workItem.AreaId = Project.Item(0).AreaRootNodes("BITS").Id
workItem.Fields("Assigned To").Value = strAssUser
workItem.Fields("System Info").Value = "Access V 1.1.25"
workItem.Fields("Repro Steps").Value = Desc
Dim result As ArrayList = workItem.Validate()
If result.Count > 0 Then
Return (result(0).ToString + "There was an error adding this work item to the work item repository")
Else
workItem.Save()
End If
' Open the new item in explorer
Dim myService = teamFoundationServer1.GetService(Of TswaClientHyperlinkService)()
Dim myUrl = myService.GetWorkItemEditorUrl(workItem.Id)
Dim oProcess As New System.Diagnostics.Process()
oProcess.StartInfo.FileName = myUrl.ToString
oProcess.Start()
Return "OK"
End Function
End Class

Export Gridview connected to MYSQL data to excel

I have a simple form created in Visual Studio (VB) which has a data gridview connected to a table in MySQL (hosted in a remote server).
I have the below code to export the grid view to Excel but it takes a really long time to export (around 15 minutes).
The table in MySQL is really small (1000 rows and 60 columns).
Is there a better way to export the complete MySQL table to excel?
PLEASE HELP
CODE:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
Dim i As Integer
Dim j As Integer
xlApp = New Microsoft.Office.Interop.Excel.Application
xlWorkBook = xlApp.Workbooks.Add(misValue)
xlWorkSheet = xlWorkBook.Sheets("sheet1")
For i = 0 To DataGridView1.Rows.Count - 1
For j = 0 To DataGridView1.Columns.Count - 1
For k As Integer = 1 To DataGridView1.Columns.Count
On Error Resume Next
xlWorkSheet.Cells(1, k) = DataGridView1.Columns(k - 1).HeaderText
xlWorkSheet.Cells(i + 2, j + 1) = DataGridView1(j, i).Value.ToString()
Next
Next
Next
xlWorkSheet.SaveAs("C:\Users\USERNAME\Desktop\vbexcel.xlsx")
xlWorkBook.Close()
Is there two ways to do this :
using rdlc reports.
using gridview exporting.
first way you need to created rdlc report, then retrieving data into datatable, then call this code:
Dim MyDataSource As ReportDataSource = New ReportDataSource("ReportDataSet", MyDataTable)
reportviewer1.LocalReport.ReportPath = Server.MapPath("MyrdlcReportPath")
rvSmartCardsIssues.LocalReport.EnableExternalImages = True
rvSmartCardsIssues.LocalReport.DataSources.Clear()
rvSmartCardsIssues.LocalReport.DataSources.Add(MyDataSource )
rvSmartCardsIssues.LocalReport.Refresh()
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim bytes As Byte()
bytes = rvSmartCardsIssues.LocalReport.Render("Excel", Nothing, mimeType, encoding, extension, streamids, warnings)
HttpContext.Current.Response.Buffer = True
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ContentType = mimeType
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=ExportedFileName.xls")
HttpContext.Current.Response.BinaryWrite(bytes)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
second way that based on this function :
Public Shared Sub ExportGridViewToExcelGridView(ByVal Filename As String, ByRef gvr As GridView, ByRef currentPage As Page)
Dim HtmlForm As System.Web.UI.HtmlControls.HtmlForm = New System.Web.UI.HtmlControls.HtmlForm()
currentPage.Controls.Add(HtmlForm)
HtmlForm.Controls.Add(gvr)
currentPage.Response.Clear()
currentPage.Response.Buffer = True
currentPage.Response.AddHeader("Content-Disposition", "attachment; filename=" & Filename)
currentPage.Response.ContentType = "application/vnd.ms-excel"
currentPage.Response.ContentEncoding = System.Text.Encoding.UTF8
currentPage.Response.Charset = ""
currentPage.EnableViewState = False
Using strwriter As New StringWriter
Dim htmlwrt As HtmlTextWriter = New HtmlTextWriter(strwriter)
HtmlForm.RenderControl(htmlwrt)
htmlwrt.Flush()
currentPage.Response.Write(strwriter.ToString)
currentPage.Response.End()
End Using
End Sub
make sure that when you use second way to set the gridview paging property to false.

LotusScript Function Doesn't Save Form Fields

Can anyone spot an obvious reason as to why my save function isn't saving the fields in my form? It saves the document, but the fields are empty when I open it up. The following code is what I'm using:
Public Sub co_loopNamesAndSaveDocs()
'Dim variables
Dim s As New NotesSession
Dim thisDatabase As NotesDatabase
Set thisDatabase = s.CurrentDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim currentDoc As NotesDocument
Set currentDoc = uidoc.Document
Dim newDoc As NotesDocument
Dim PersonNameField As NotesItem
Set PersonNameField = currentDoc.GetFirstItem("PersonName")
'Loop through values in PersonNameField and create a new document for each value found
Forall pName In PersonNameField.Values
Set newDoc = New NotesDocument (thisDatabase)
newDoc.Form="newLocationForm"
newDoc.StartDate = currentDoc.StartDate(0)
newDoc.EndDate = currentDoc.EndDate(0)
newDoc.Duration = currentDoc.Duration(0)
newDoc.StartTime = currentDoc.StartTime(0)
newDoc.EndTime = currentDoc.EndTime(0)
newDoc.Comments = currentDoc.Comments(0)
newDoc.Status = currentDoc.Status(0)
newDoc.LocationCode = currentDoc.LocationCode(0)
newDoc.PersonName = pName
Call newDoc.Save (True, False, False)
End Forall
End Sub
Thanks in advance.
Since I don't see an obvious error in the coding, I'd say that the fields in newDoc are blank because the fields in currentDoc are blank. And since currentDoc was set to uidoc.Document, that probably means that you have a synch problem between front-end and back-end documents. I.e., the values exist in your uidoc, but have not yet been saved to the back-end prior to calling this code. If I'm right, try calling uidoc.save() before assigning currentDoc. If you don't want to save to the back-end, then instead of using the back-end as your data source you should be using uidoc.fieldGetText("PersonName") and parsing out the values.