hey, here i have a question. i want to select a directory path alone... For example, by using "openfiledialog" control, we can select the file path (eg., d:\sample\dest.txt). But i want to select only the path (eg., d:\sample\).... can anyone help me ? thanks in advance...........

or role your own if you don't want to import IO library for such trivial things;

public class MyPathInfo
	{
		public MyPathInfo()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		public static string GetDir(string path)
		{
			string dir = path.Substring(0, findLastSlash(path)+1);

			return dir;
		}

		private static int findLastSlash(string path)
		{
			int curPos = 0;
			int slashPos = -1;
			int startPos = 0;

			while(curPos != -1)
			{
				if(startPos > 0)
					slashPos = curPos;

				curPos = path.IndexOf("/", startPos);
				startPos = curPos;
				startPos++;
			}

			return slashPos;
		}
	}

Sorry it's C# but I can't type VB anymore I did it for years, but now it just makes my teeth jangle ;)

Why not use the FolderBrowserDialog in the tool box?

thanks for all ur replies.........i found the answer...using 'browseforfolder' control and "selectedpath" function we can get it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.