Sandisk U3 Application - DefaultReportSettingsPath

Stimulsoft Reports.NET discussion
Post Reply
xfratboy
Posts: 7
Joined: Thu Aug 14, 2008 3:07 pm
Location: Texas

Sandisk U3 Application - DefaultReportSettingsPath

Post by xfratboy »

I'm working on a demo project that needs to run completely from a USB drive. I've noticed that some settings get written to the user\local settings\applications\ folder. How can a force Stimulsoft to maintain all settings and files within a different folder (e.g. System.Windows.Forms.Application.StartupPath).

I don't/can't have anything from my demo being written to the local computer. I know that I can massage the U3 settings to clean things up upon ejection of the USB drive, but it would be a lot easier and cleaner if I could just make that setting persist within stimulsoft's configuration somehow.

I'm coding in VB not C# and examples I've found are only in C#. Any ideas?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Sandisk U3 Application - DefaultReportSettingsPath

Post by Edward »

Hi.

You can use the following shared properties for setting of the default configuration report paths:

Code: Select all

Stimulsoft.Report.StiOptions.Configuration.DefaultReportConfigPath 
Stimulsoft.Report.StiOptions.Configuration.DefaultReportSettingsPath 
Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization
You must assign all these shared properites in a vaery beginning of your application when none of Stimulsoft Reports.Net objects have been created.

Thank you.
xfratboy
Posts: 7
Joined: Thu Aug 14, 2008 3:07 pm
Location: Texas

Sandisk U3 Application - DefaultReportSettingsPath

Post by xfratboy »

So, I must be doing something wrong. I put this in the _load section of my form But I get this error:


Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Stimulsoft.Report.StiOptions.Configuration.DefaultReportConfigPath = System.Windows.Forms.Application.StartupPath & "\MyFolder\"
Stimulsoft.Report.StiOptions.Configuration.DefaultReportSettingsPath = System.Windows.Forms.Application.StartupPath & "\MyFolder\"
Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = System.Windows.Forms.Application.StartupPath & "\MyFolder\"

StiConfig.Load()

' ''Get service
Dim Config As Render.StiPreviewConfigService = TryCast(StiConfig.Services.GetService(GetType(Render.StiPreviewConfigService)), Render.StiPreviewConfigService)
' ''Turn off all unnecessary buttons

Config.PageNewEnabled = False
Config.PageDeleteEnabled = False
Config.PageDesignEnabled = False
Config.PageSizeEnabled = False
Config.OpenEnabled = False
Config.SaveEnabled = False
Config.ToolHandEnabled = False
Config.ToolEditorEnabled = False


' ''Save configuration if necessary
' ''StiConfig.Save()

' ''StiConfig.Load()
Dim Services As StiServiceContainer = StiConfig.Services.GetServices(GetType(StiExportService))
For Each Service As StiService In Services
If TypeOf Service Is StiTxtExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiXmlExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiOdsExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiOdtExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiMhtExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiExcelExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiExcelXmlExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiXpsExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiExcel2007ExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiWord2007ExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiHtmlExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiDbfExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiCsvExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiRtfExportService Then Service.ServiceEnabled = False
If TypeOf Service Is StiEmfExportService Then Service.ServiceEnabled = True
If TypeOf Service Is StiGifExportService Then Service.ServiceEnabled = True
If TypeOf Service Is StiJpegExportService Then Service.ServiceEnabled = True
If TypeOf Service Is StiPdfExportService Then Service.ServiceEnabled = True
If TypeOf Service Is StiTiffExportService Then Service.ServiceEnabled = True
If TypeOf Service Is StiBmpExportService Then Service.ServiceEnabled = True
Next Service
StiConfig.Save() <-- Object reference not set to an instance of an object.

End Sub
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Sandisk U3 Application - DefaultReportSettingsPath

Post by Vital »

Hello,
So, I must be doing something wrong. I put this in the _load section of my form But I get this error:
Please provide full error stack.

Thank you.
Post Reply