VB.NET add enumerated folders to directory - vb.net

I need to create an application that will allow normal user to add folders into a directory that already contains folders.
How it's setup is that the folder is ordered by job number so we have several hundered folders all named with numbers.
What I need to do is read a directory and know what the last number in that directory is and add more folders based on user input.
I have looked on here and found tons of ways to list the directories in an existing folder. Such as this one Get all folder / directories list in VB.net but I am not as familiar with VB.NET as I need to be to modify that to keep last folder in the directory and use it to add more.

Related

List files and paths in a VB poject

I have several VB.Net projects each with containing many files/forms. Several of the forms are shared/linked between more than one project and saved in a shared folder. Recently I discovered one file that should have been shared was not, meaning that there were two files with the same name in two different folders. Obviously any change of a file in one project was not shown in the other poject. Is there any way of listing all the files and paths in a project - either to screen or spreadsheet?
you should take a look at the projectname.vbproj file, it is a xml file and in the node called <ItemGroup> you are going to find what you are looking for, you can tell if a file is a linked one if inside the <Compile> node there is a <Link> tag.

Writing to a document's enclosing folder

When you open an XCode project it can automatically write to the enclosing folder of the respective .xcodeproj file.
In a sandboxed application you can only write to files that are opened, or write to directories that have been opened with NSOpenPanel.
What I'm trying to achieve is the same functionality as XCode ; my app makes a project file (a document much like an .xcodeproj file) that is saved to a user-selected directory, and within that directory other files are created relating to that project file. However, if the file is re-opened after terminating the app, I end up losing permission to write to the enclosing directory.
I see bookmarks are an option but they do not provide the same functionality. If the project file is moved to a new directory it makes no sense to keep writing to the old directory, and I'd have to ask the user for permission to write to the new directory. I don't find this user-friendly. Is there absolutely no way to resolve this problem?
If the project file is moved to a new directory it makes no sense to keep writing to the old directory, and I'd have to ask the user for permission to write to the new directory. I don't find this user-friendly. Is there absolutely no way to resolve this problem?
Unfortunately for you this is Apple's sandbox model and you need to adapt to it. The process you describe is a good way to handle your situation - when you first create a project file ask the user to select the folder to store it and save a bookmark to that folder, when an existing project file is opened check whether you have a saved bookmark for its parent folder and if not put up a dialog explaining the file has been moved and ask the user for permission to use the new parent folder and keep a bookmark to it.
Users are used to these dialogs from apps, the sandbox has been around a long time. You might find keeping a number of saved bookmarks and optimising your collection will improve your users experience. E.g. remember that a bookmark to a folder grants access to all the files and folders within it, and the files/folders within those folders, etc. This means if a user reorganises by moving projects into sub folders may not require you to ask for a new bookmark, and similarly when a new bookmark is acquired any existing ones you have stored to folders contained by the new bookmark's folder are redundant and can be removed from your collection of stored bookmarks.
Not the answer you really wanted, but hope it helps!

How do I move/download a file do a directory without knowing users name?

So I am making a downloader/installation program and I want it to download to a folder in the roaming folder but I need to know the users name (current logged in users) to be able to move a file there how would I accomplish this?
The following code will get you the Desktop folder:
Environment.GetFolderPath(Environment. SpecialFolder.Desktop)
Similarly, you can get the other special folders using the other enum values of Environment. SpecialFolder

Common place for custom helper Matlab scripts and function?

Matlab Central file exchange contains numerous helper scripts and functions. Is it possible to place them somewhere in order not to populate current (project) directory with helper files?
There is set of functionality that concerns itself with search path (documentation).
What Is the MATLAB Search Path?
The search path, or path is a subset of all the folders in the file system. MATLAB® software uses the search path to efficiently locate files used with MathWorks® products. MATLAB can access all files in the folders on the search path.
Add Folders to Search Path Upon Startup
The startup.m file is for specifying startup options. You can add folders to the search path by including addpath statements in startup.m. For example, to add the specified folders, /home/username/mytools to the search path, include this statement:
addpath /home/username/mytools

Application Working Directory (VB.NET)

I am linking few excel and word files with my application. There is a predefined folder structure that holds all these files. i.e.
Base\Engineering\A.xlsx
Base\Sales\B.xlsx
and so on.
Now I want to link the "Base" folder with my application.
My current stupid solution is, to ask user to browse to the "Base" folder every time the application loads.
What is the most efficient way to do this?
In the end I want to create an installer for my application. I
wish to use Windows "Program Files" folder to host my folder
structure. This way users do not have to search for the "Base"
folder. How do I do this?
I am new to VB.NET.
You want the All Users Application Data folder:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
There is also a per-User Application Data folder that you can reference. Which you need depends on what you're doing.