Parameters
- fileInfo
- FileInfo wrapper for the section or page report to load
/// <summary> /// OpenReportFile - Open the 'Open File' dialog, select the rpx file of the report and open it /// </summary> private void OpenReportFile() { try { this.dlgOpenFile.Filter = "ActiveReport Report Design (RPX) (*.rpx)|*.rpx"; this.dlgOpenFile.FilterIndex = 2; this.dlgOpenFile.RestoreDirectory = true ; this.dlgOpenFile.DefaultExt = ".rpx"; if(dlgOpenFile.ShowDialog() == DialogResult.OK) { this._alreadySaved = true; //Add the opened report to the latest cache if(System.IO.File.Exists(Application.StartupPath + @"\Settings\recent.xml")) { DataSet _reportsDS = new DataSet(); _reportsDS.Locale = CultureInfo.InvariantCulture; _reportsDS.ReadXml(Application.StartupPath + @"\Settings\recent.xml"); DataTable _reportsTable = _reportsDS.Tables["Reports"]; _reportsTable.Locale = CultureInfo.InvariantCulture; //Create a row DataRow _rowReports = _reportsTable.NewRow(); object [] _myArray = new object[2]; this._savedPath = this.dlgOpenFile.FileName; _myArray[0] = this.dlgOpenFile.FileName; _myArray[1] = System.DateTime.Now; _rowReports.ItemArray = _myArray; _reportsTable.Rows.Add(_rowReports); _reportsDS.WriteXml(Application.StartupPath + @"\Settings\recent.xml", XmlWriteMode.WriteSchema); } //Load the report this.ardMain.LoadReport(new System.IO.FileInfo(this._savedPath)); } //Fill the designer's combo box this.FillCombo(); } catch(System.IO.IOException ex) { MessageBox.Show(ex.ToString()); } }
'OpenReportFile - Open the 'Open File' dialog, select the rpx file of the report and open it Private Sub OpenReportFile() Try Me.dlgOpenFile.Filter = "ActiveReport Report Design (RPX) (*.rpx)|*.rpx" Me.dlgOpenFile.FilterIndex = 2 Me.dlgOpenFile.RestoreDirectory = True Me.dlgOpenFile.DefaultExt = ".rpx" If dlgOpenFile.ShowDialog() = DialogResult.OK Then Me._alreadySaved = True 'Add the opened report to the latest cache If System.IO.File.Exists((Application.StartupPath + "\Settings\recent.xml")) Then Dim _reportsDS As New DataSet() _reportsDS.Locale = CultureInfo.InvariantCulture _reportsDS.ReadXml((Application.StartupPath + "\Settings\recent.xml")) Dim _reportsTable As DataTable = _reportsDS.Tables("Reports") _reportsTable.Locale = CultureInfo.InvariantCulture 'Create a row Dim _rowReports As DataRow = _reportsTable.NewRow() Dim _myArray(1) As Object Me._savedPath = Me.dlgOpenFile.FileName _myArray(0) = Me.dlgOpenFile.FileName _myArray(1) = System.DateTime.Now _rowReports.ItemArray = _myArray _reportsTable.Rows.Add(_rowReports) _reportsDS.WriteXml(Application.StartupPath + "\Settings\recent.xml", XmlWriteMode.WriteSchema) End If 'Load the report Me.ardMain.LoadReport(New System.IO.FileInfo(Me._savedPath)) End If 'Fill the designer's combo box Me.FillCombo() Catch ex As System.IO.IOException MessageBox.Show(ex.ToString()) End Try End Sub