Page 1 of 1
Using RRW.OCX under .NET
Posted: Wed Jun 11, 2008 11:52 am
by kfleming
Is there any one out there who is successfully using our OCX interface to call reports from a .NET application?____Kathleen__R&R Support
=> RE: Using RRW.OCX under .NET
Posted: Fri Jun 13, 2008 2:11 pm
by Direct Lenders
I am when I run it on a PC that has R&R Infinity on it. However, I^ve not been able to make a successful deployment package. The problem is that I am unable to get rsw32.ocx to register even when I try to register it manually. I am using PC^s with XP Pro SP2. Any help in this regard would be greatly appreciated.
==> RE: Using RRW.OCX under .NET
Posted: Thu Jul 03, 2008 12:05 pm
by BruceMP
Dave,____Would you able to post some sample code to show how you got it working? Whenever I try it throws an exception.____Thanks,__Mike
===> RE: Using RRW.OCX under .NET
Posted: Fri Jul 11, 2008 3:05 pm
by BruceMP
To be more specific, I instantiate the object using____Type.GetTypeFromProgId (using "R&R.ReportControl")(or Type.GetTypeFromCLSID using the relevant CLSID from the registry). This appears to work, no exception is thrown. I then instantiate an object using Activator.CreateInstance, which also completes without exception.____However when I call Type.InvokeMember to call the required properties or methods, a Catastrophic error exception is thrown.____I^ve used this approach in the past with other COM objects successfully, so I wonder what I^m missing with this one.____I don^t want to generate an AxHost wrapper class for the ocx because the library that^s calling it doesn^t have a reference to System.Windows.Forms, and I don^t want to give it one.____Mike
====> RE: Using RRW.OCX under .NET
Posted: Sun Jul 20, 2008 10:06 am
by DAVE_I
Here^s my basic approach:__1) I have the runtime details about all the reports in a dbf file__2) I have screens appropriate for the various reports built where I prompt the user for some parameters for their selected reports__3) in the code below, I^ve already obtained parameters from the user on the screen and then I read the values from the dbf file for their previously selected report. __4) finally, i pass these parameters to the report and run it. I allow the user to set additional filters via R&R just prior to running the report.__Private Sub RunReport()__ Try____ ^ GetParameters() didn^t link in yet for this report__ Dim data As New Data__ Dim settings As New Settings__ Dim sKeyword As String = settings.SelectedReport__ Dim sSearchby As String = "RI_REPORT"__ Dim sTable As String = settings.myReportsPath + "RRWRUNIN.DBF"__ Dim sOrderby As String = "RI_REPORT"____ Dim s_RI_REPORT As String = ""__ Dim s_RI_LIBRARY As String = ""__ Dim s_RI_MASTER As String = ""__ Dim s_RI_OUTFILE As String = ""__ Dim s_RI_CHKTIME As String = ""__ Dim s_RI_NOESC As String = ""__ Dim s_RI_PRINTER As String = ""__ Dim s_RI_BEGPAGE As String = ""__ Dim s_RI_ENDPAGE As String = ""__ Dim s_RI_TEST As String = ""__ Dim s_RI_SCOPE As String = ""__ Dim s_RI_COPIES As String = ""__ Dim s_RI_FILTER As String = ""__ Dim s_RI_QUERY As String = ""__ Dim s_RI_DISPERR As String = ""__ Dim s_RI_STATUS As String = ""__ Dim s_RI_ALIAS4 As String = ""__ Dim s_RI_PAGESIZ As String = ""__ Dim s_RI_WPTR As String = ""__ Dim s_RI_WPORT As String = ""__ Dim s_RI_WTITLE As String = ""__ Dim s_RI_WTOP As String = ""__ Dim s_RI_WLEFT As String = ""__ Dim s_RI_WHEIGHT As String = ""__ Dim s_RI_WWIDTH As String = ""__ Dim s_RI_WBORDER As String = ""__ Dim s_RI_WMAX As String = ""__ Dim s_RI_WMIN As String = ""__ Dim s_RI_WCTRL As String = ""__ Dim s_RI_WPARENT As String = ""__ Dim s_RI_INCLUDE As String = ""__ Dim s_RI_REPLACE As String = ""__ Dim s_RI_WHERE As String = ""__ Dim s_RI_DSOURCE As String = ""__ Dim s_RI_DB As String = ""__ Dim s_RI_EXPDST As String = ""__ Dim s_RI_SORT1 As String = ""__ Dim s_RI_GROUP1 As String = ""__ Dim s_PRE_REPORT As String = ""__ __ data.GetSelectedReport(sKeyword, sSearchby, sTable, sOrderby)__ If data.drITDBF.HasRows Then__ __ While (data.drITDBF.Read())__ s_RI_REPORT = (data.drITDBF("RI_REPORT").ToString())__ s_RI_LIBRARY = (data.drITDBF("RI_LIBRARY").ToString())__ s_RI_MASTER = (data.drITDBF("RI_MASTER").ToString())__ s_RI_OUTFILE = (data.drITDBF("RI_OUTFILE").ToString())__ s_RI_OUTFILE = settings.myReportsPath.ToString() + "rswrunout.txt"__ __ s_RI_PRINTER = (data.drITDBF("RI_PRINTER").ToString())__ __ s_RI_FILTER = (data.drITDBF("RI_FILTER").ToString())__ s_RI_QUERY = (data.drITDBF("RI_QUERY").ToString())__ __ s_RI_WPTR = (data.drITDBF("RI_WPTR").ToString())__ __ s_RI_WTITLE = (data.drITDBF("RI_WTITLE").ToString())__ s_RI_WTOP = (data.drITDBF("RI_WTOP").ToString())__ s_RI_WLEFT = (data.drITDBF("RI_WLEFT").ToString())__ s_RI_WHEIGHT = (data.drITDBF("RI_WHEIGHT").ToString())__ s_RI_WWIDTH = (data.drITDBF("RI_WWIDTH").ToString())__ s_RI_WBORDER = (data.drITDBF("RI_WBORDER").ToString())__ s_RI_WMAX = (data.drITDBF("RI_WMAX").ToString())__ s_RI_WMIN = (data.drITDBF("RI_WMIN").ToString())__ s_RI_WCTRL = (data.drITDBF("RI_WCTRL").ToString())__ s_RI_WPARENT = (data.drITDBF("RI_WPARENT").ToString())__ s_RI_INCLUDE = (data.drITDBF("RI_INCLUDE").ToString())__ s_RI_REPLACE = (data.drITDBF("RI_REPLACE").ToString())__ s_RI_WHERE = (data.drITDBF("RI_WHERE").ToString())__ s_RI_DSOURCE = (data.drITDBF("RI_DSOURCE").ToString())__ s_RI_DB = (data.drITDBF("RI_DB").ToString())__ __ s_RI_SORT1 = (data.drITDBF("RI_SORT1").ToString())__ __ s_RI_GROUP1 = (data.drITDBF("RI_GROUP1").ToString())__ __ End While____ Else__ MessageBox.Show("No report of that name. Try again")__ End If__ data.CloseITDBFDatabase()____ __ Dim s_ApplicationStartupPath As String = Application.StartupPath.ToString()__ __ Me.RSReport1.ReportName = settings.myReportsPath + s_RI_REPORT__ __ Me.RSReport1.WindowTitle = s_RI_WTITLE__ __ Me.RSReport1.DataSource = "|||DBQ=" + settings.myReportsPath + "IT6.MDB"__ Me.RSReport1.Destination = s_RI_PRINTER ^ destination will be screen, printer, etc; 4 = dbf file__ Me.RSReport1.Printer = s_RI_WPTR ^specific printer is selected__ __ Me.RSReport1.Include = s_RI_INCLUDE____ myparamstring = myparamstring + "Line_1=" + Me.txtTitle.Text + ";LINE_2=" + Me.txtTitle2.Text____ Me.RSReport1.ParametersString() = myparamstring ^ works; puts mytest into a calculated field called startdate which is RIPARAM("startdate")__ Me.RSReport1.DisplayError = True__ Me.RSReport1.SuppressTitle = False ^false will make Title and Summary lines will be printed even when no records are found__ __ MessageBox.Show("On the next screen you can optionally set additional filters")__ Me.RSReport1.RunReport(1)__ __ Catch ex As Exception__ Throw (ex)__ End Try__ End Sub