How can I add a configuration file to an infopath project

D

Duray AKAR

How can I add a configuration file to an infopath project in VS.NET ?

Example:

Install Microsoft Infopath Toolkit for VS.NET
Create an infopath project
Add a class library to your new solution
Add a windows forms to your class library
Reference the class library in your InfoPath project
Add a button to your infopath from
Edit the button click event, initiate and display a new instance of the
form...
Hit F5
Click the button

works perfect...

now...

stop

Go to your windows form
Right clcik the form and go to properties
Go to Dynamic Properties > Advanced > Text
Type a name for your configuration value

Hit F5
Click the button

Error:
System.InvalidOperationException
The key 'frmSearch.Text' does not exist in the appSettings configuration
section.
at System.Configuration.AppSettingsReader.GetValue(String key, Type type)
at InfopathForms.frmSearch.InitializeComponent()
at InfopathForms.frmSearch..ctor()
at InfopathForms.UIManager.SearchYachts()
at InfoPathProject1.InfoPathProject1.btnForm_OnClick(DocActionEvent e) in
d:\duray\test\infopathproject1\formcode.cs:line 50
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


The app config is there but just does not work...

Any ideas ?

PS:
I have web service locations and connection strings in the config uration
files for my business layer and DAL components... I want to use them in
Infopath

PSPS:

I will install my form with an installer, so i can deploy the config file as
well.

_____________________________

Duray AKAR
 
M

Matthew Blain \(Serriform\)

You can't use app.config. Here's an old thread in the ugly new google groups
interface...
http://groups-beta.google.com/group...cf75ea/d428ad85de373fb7?q=infopath.exe.config

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/

Duray AKAR said:
How can I add a configuration file to an infopath project in VS.NET ?

Example:

Install Microsoft Infopath Toolkit for VS.NET
Create an infopath project
Add a class library to your new solution
Add a windows forms to your class library
Reference the class library in your InfoPath project
Add a button to your infopath from
Edit the button click event, initiate and display a new instance of the
form...
Hit F5
Click the button

works perfect...

now...

stop

Go to your windows form
Right clcik the form and go to properties
Go to Dynamic Properties > Advanced > Text
Type a name for your configuration value

Hit F5
Click the button

Error:
System.InvalidOperationException
The key 'frmSearch.Text' does not exist in the appSettings configuration
section.
at System.Configuration.AppSettingsReader.GetValue(String key, Type type)
at InfopathForms.frmSearch.InitializeComponent()
at InfopathForms.frmSearch..ctor()
at InfopathForms.UIManager.SearchYachts()
at InfoPathProject1.InfoPathProject1.btnForm_OnClick(DocActionEvent e) in
d:\duray\test\infopathproject1\formcode.cs:line 50
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnCl
ick(DocActionEvent pEvent)
 
M

Matthew Blain \(Serriform\)

But (as mentioned in the referenced thread) you can use your own XML files
as a secondary data source.

I'm replying to myself to point out the following cool-looking solution to
the offline problem:

http://jelle.druyts.net/PermaLink.aspx?guid=79de2f23-4e00-4b5e-8001-395f2a6ba23d


Matthew Blain (Serriform) said:
You can't use app.config. Here's an old thread in the ugly new google groups
interface...
http://groups-beta.google.com/group...cf75ea/d428ad85de373fb7?q=infopath.exe.config

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/

Duray AKAR said:
How can I add a configuration file to an infopath project in VS.NET ?

Example:

Install Microsoft Infopath Toolkit for VS.NET
Create an infopath project
Add a class library to your new solution
Add a windows forms to your class library
Reference the class library in your InfoPath project
Add a button to your infopath from
Edit the button click event, initiate and display a new instance of the
form...
Hit F5
Click the button

works perfect...

now...

stop

Go to your windows form
Right clcik the form and go to properties
Go to Dynamic Properties > Advanced > Text
Type a name for your configuration value

Hit F5
Click the button

Error:
System.InvalidOperationException
The key 'frmSearch.Text' does not exist in the appSettings configuration
section.
at System.Configuration.AppSettingsReader.GetValue(String key, Type type)
at InfopathForms.frmSearch.InitializeComponent()
at InfopathForms.frmSearch..ctor()
at InfopathForms.UIManager.SearchYachts()
at InfoPathProject1.InfoPathProject1.btnForm_OnClick(DocActionEvent e) in
d:\duray\test\infopathproject1\formcode.cs:line 50
at
Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnCl
ick(DocActionEvent pEvent)
The app config is there but just does not work...

Any ideas ?

PS:
I have web service locations and connection strings in the config uration
files for my business layer and DAL components... I want to use them in
Infopath

PSPS:

I will install my form with an installer, so i can deploy the config
file
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top