Im looking for a way to get the parent directory of a file. Ive tried using Directory.GetParent() but its not doing what i want it to do. For example lets say i have 3 files:[code]I want to get "Test" and not "C:"Its probably simple but as usual im overthinking and made no progress for 2 hours now and its frustrating.
I'm making a Windows Forms application and I am about to publish it to a ClickOnce to distribute on a CD. The program refers to a LOT of files, e.g. pictures, which I have in a folder on disc called GAMEFILES. It's in the Solution Explorer. That folder does itself have a lot of subfolders. (I'm sort of a tidiness freak.)[code]...
I am trying to see if IIS is installed and display a message and a download exe to INstall IIS if IIS isn't installed.However i am having a hard time running a file without specifying the full path in the vb-script.The path will be dynamic and it impossible to specify any other directory than "%cd% [code]...
i have to get the files in all the directories with date formats in file name and also in extension. Some thing like new_mmddyyyy.txt / new_yyyymmdd.* like this....
I'm trying to copy a file (pdftk.exe) from the Current Working Directory the VB.NET program is in.The file is to be copied to the Selected Path from the Folder Dialog Browser.I tried this code, but it seems it's not working
Imports System Imports System.IO Public Partial Class MainForm
I want to add a browse button to my program to browse for a pdf file and then it should upload the file to my programs working directory. For example if my program is installed in c:/program files/myprogram i want it to upload the file to a sub directory called contracts but it should detect the program directory automatic.
I am working on a project I have a form that contains a web browser and I want to write a function that will place the Source (HTML) of the page in a text file I have put some code together it doesn't throw up an error but at the same time doesn't work:
how can i open file .exe in the same my application directory i tried Call Process.Start(IO.Path.Combine(Application.StartupPath, filename))but it open my application not anther one?
So I open files and do whatever with them right. I've set the initial directory to equal the last directory, but whenever I open multiple files, it never sets the directories properly. It acts as though nothing was opened there, so it takes the previous directory as the last one. Thoughts on what's not working? Here's the code.
Code: With FileOpenDialog1 .InitialDirectory = LastDirectory If .ShowDialog = DialogResult.OK Then
[code]....
I have multiselect enabled earlier and everything else works but this. When you open a single file, the last directory works fine. It only happens with multiselect.On another note, does anyone know why it freezes when I try to do a lot of files and use another program? I opened 700+ files to see what would happen. When I switched to a IM convo, it froze. When I left it to run, it worked.
How do I get a file's directory when open with or send to event happens?I want it like media player, the application can get the file name & path when the user runs it with Open With.
I'm running in to a bit of a strange error with an application I'm writing. I have a number of shortcuts on my computer desktop that take me to my various folders (documents, music, etc) and have always been able to navigate using them when I open a file through applications such as Word. However when I use an OpenFileDialog box in VB.NET and select one of these shortcuts to take me to the file I'm after I am getting the following error message...
I have several groups of files with idential names, but the files inside may or may not have identcal names, and may differ only in the size or date stamp. I want to combine them to save all unique directory names, and unique file names, and if the date/sizes are unique, then add some number on the end of the file name to make them unique as well. Only idential file sizes and names and dates will be discarded. How do you open directories to compare directory/file names and other properties?
how to copy, delete, show files, show current directory, change directory, make folder, rename folder. My problem is i have a method on deleting a file and copying a file, but i don't know how to pass the method so that when i click the delete button it would let me choose what file to delete. By the way im using buttons on each function.[code...]
I have an ACCESS database containing VBA code residing on a USB drive in a directory called 'collect'. When the application runs the code uses a DLL that is in the same directory as the application. The code in the DLL is VB.NET.
The DLL is declared :
Private Declare Function Collect Lib "x:collectwcolv332.dll" (ByRef Str As Any)
This works fine but it only works when the USB drive is mapped to x:
The follwoing which I expected to work does not
Private Declare Function Collect Lib "wcolv332.dll" (ByRef Str As Any)
and neither does
Private Declare Function Collect Lib "collectwcolv332.dll" (ByRef Str As Any)
I want to save the directory that a user chooses when they open a file with the OpenFileDialog. I currently have
FileDir=My.Computer.FileSystem.CurrentDirectory
after the open dialog, and this works ok in Windows XP. But on Windows Vista this seems to give the Application (.exe) directory, whihc is not what we want.
First off a short background of the project I am working on- I am developing a program that will be run off removable media (i.e. USB Flash drive). This will be a �virtual desktop� which you will be able to take with you and have the same �desktop� on any system. As we know drive letters can change with each host system the drive is plugged into, I need to be able to determine the path for the flash drive and access a specific folder ( i.e. My Documents)
I have an picture box(representing the icon) placed on my form (form1) and when I click the icon I want to be able to open and view the a specific folder from the portable drive. I need a click event that will determine a dynamic drive letter for a directory on the removable drive and then open that directory in an explorer window.
For some reason the Current Directory of my windows service is C:WindowsSystem32 and when I schedule my service I get this error Access is Denied.
In one of the blogs I saw this peice to change the current directory. But I am not sure where to place this code. System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory)
I cannot read files from the current directory. If I give it a absolute path name, works fine.
I get a file not found error, saying C:programfilesCommenfilesMicrsoftsharedevserver10.0stormdoor.html. A interested fact is that my project is not stored in the folder it says it's current, the project is stored in C:useres edpoottelmydoumentsVisual studio 2010WEbSitesmaster2
I'm using Microsoft Visual Studio 2005 professional edition and I was wondering how to put files with a certain extension such as .txt from the applications current directory into a combo box in the application itself.
I have no idea how to do this or even if it's possible.Actually if no one knows I would like to ask how to get a button to open up one of those file browsers to look for a certain file and then assign a variable to the path of the file selected.