Using multiple files in a project

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
LexelSystems
Posts: 8
Joined: Thu May 08, 2014 4:54 pm

Using multiple files in a project

Post by LexelSystems »

Hey,

What is the best way to use multiple files to split up a large win forms project?

For example I would like to have global variables in one file, and global functions in another. I have multiple tabs on my win form, each to run a different admin task. I would like the code for each of these tasks to also be in separate files. Currently I have this all in one file, and it has become very difficult to manage.

How can I do this and make variables and functions available across all the files?

Your suggestion would be much appreciated.

PowerShell Studio 2014, Version & Build: 4.1.74
Last edited by LexelSystems on Thu Dec 04, 2014 2:12 am, edited 1 time in total.

User avatar
SAPIEN Support Forums
Posts: 945
Joined: Wed Dec 03, 2014 2:26 pm

Using multiple files in a project

Post by SAPIEN Support Forums »

This is an automated post. A real person will respond soon.

Thank you for posting, LexelSystems.

Did you remember to include the following?
  • 1. Product, version and build (e.g. Product: PowerShell Studio 2014, Version & Build: 4.1.71. Version and build information can be found in the product's About box accessed by clicking the blue icon with the 'i' in the upper right hand corner of the ribbon.)
    2. Specify if you are running a 32 or 64 bit version
    3. Specify your operating system and if it is 32 or 64 bit.
    4. Attach a screenshot if your issue can be seen on the screen
    5. Attach a zip file if you have multiple files (crash reports, log entries, etc.) related to your issue.
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Using multiple files in a project

Post by davidc »

You can create a Forms Projects and it allows you to use global file (Globals.ps1) in which you can place functions and variables accessible to the rest of the project.

To create a new project: Ribbon->File->New->New Form Project

As for the tabs, you are limited to the single form in that regard. Alternatively, you can create a main form that has buttons to show a different form for each section (assuming they are independent).

If you want to see a sample multi-form project go to: Ribbon->Help->Product Support->Samples

The SAPIEN Document Explorer is required to view the sample.

David
David
SAPIEN Technologies, Inc.

User avatar
LexelSystems
Posts: 8
Joined: Thu May 08, 2014 4:54 pm

Re: Using multiple files in a project

Post by LexelSystems »

Thanks very much ill give it a go!