VB.NET Addin settings

4079
2
Jump to solution
03-09-2016 11:31 AM
MatthewCieri
Occasional Contributor


Hi All,

I created an add-in in VB.net that opens a form from a button. Everything works well and it does everything i want it to functionally but everything is basically hard coded in the code.  Currently the code looks for specific feature classes, tables and fields that i have in my testing documents.  I would like to be able to allow the user to be able to change some of these hard coded table names into something that may make more sense to the project they are working on. 

For example: I have manholecopy and sewerlinecopy in my mxd but the user may have or want manhole and sewerline

Or a field from one project could be called InPipeElev and in another invert1Elv.

How can i add a settings file where a user can change this info or have a dialog popup that requests this info on startup.

Thanks,

Matt

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
TedKowal
Regular Contributor II

I can think of lots of way....  I have not had any need to do this...

1.  Create a ini file (you can find vb code for parsing ini files easily on the internet)  or create a txt file.

2.  on your form start event code your alias translations from the ini or txt file

-----  The closest thing I have done to what you want is to create dropdowns

Dropdowns forcing the user to select the layer to represent the table of data your program is expecting then within the leave focus event of the layer dropdown read the fields and allow the user to select the appropriate field for the variables or process you want.  This could be easily design into tabs on the form or have this form call dialogs or other sub forms.

Example.png

View solution in original post

0 Kudos
2 Replies
TedKowal
Regular Contributor II

I can think of lots of way....  I have not had any need to do this...

1.  Create a ini file (you can find vb code for parsing ini files easily on the internet)  or create a txt file.

2.  on your form start event code your alias translations from the ini or txt file

-----  The closest thing I have done to what you want is to create dropdowns

Dropdowns forcing the user to select the layer to represent the table of data your program is expecting then within the leave focus event of the layer dropdown read the fields and allow the user to select the appropriate field for the variables or process you want.  This could be easily design into tabs on the form or have this form call dialogs or other sub forms.

Example.png

View solution in original post

0 Kudos
MatthewCieri
Occasional Contributor

Thanks for the response I will look into both of these options.  I also saw something about app.settings file that can do this also.

Matt

0 Kudos