-1
DialogResult result = fbd.ShowDialog();
                if (dialogResult == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                {
                    string folder = "test";
                    Console.WriteLine(fbd.SelectedPath);
                    Directory.CreateDirectory(Path.Combine(folder + fbd.SelectedPath));
                 }

Keep getting Exception Unhandled System.NotSupportedException "The given path's formmat is not supported.'

Tried doing Path Combine, also orignially did 'Directory.CreateDirectory(fbd.selectedpath + folder). I'm fairly novice so this must be a simple fix I cannot find.

  • What is the value of `Path.Combine(folder + fbd.SelectedPath)`? – Loocid Aug 31 '23 at 05:38
  • a) You're using `Path.Combine` wrong. You should pass two separate values, else there's no point using it. b) I reckon if you actually looked at the result of `folder + fbd.SelectedPath` and (once fixed, see my first point) the result of `Path.Combine`, you'd see the problem immediately. Is there any reason why you haven't already done this? – ProgrammingLlama Aug 31 '23 at 05:38
  • Most probably you confused how to use `Path.Combine` method. IF you have already a path to some directory, that should come as first parameter and rest should be in SE[ARATE params, like: `Path.Combine(fbd.SelectedPath, folder);` – Michał Turczyn Aug 31 '23 at 05:40
  • I went ahead and did this which seemed to achieve what I wanted. `Directory.SetCurrentDirectory(fbd.SelectedPath); Directory.CreateDirectory(ffolder);` – Seth Redden Aug 31 '23 at 05:44
  • So you mean you actually wanted `Path.Combine(fbd.SelectedPath, folder)`? – ProgrammingLlama Aug 31 '23 at 05:50

0 Answers0