Laver ikke 'Catch' efter try
Hey allesammen ! Sidder med et WPF projekt hvor jeg prøver at få nogle Exceptions frem. Problemet er at mine Exceptions ikke bliver fanget. Håber i kan hjælpe !public void FolderCheck()
{
bool DidCreate = false;
string PicPath = Directory.GetCurrentDirectory() + "\\ChauPictures\\";
try
{
Status = "Tjekker om mapper eksisterer...";
Progress = 15;
BGWorker.ReportProgress(15);
if (Directory.Exists(PicPath) == false)
{
DidCreate = true;
Status = "Opretter mappe: " + PicPath.ToString();
Progress = 25;
BGWorker.ReportProgress(25);
Directory.CreateDirectory(PicPath);
Status = "Mappe oprettet...";
Progress = 75;
BGWorker.ReportProgress(75);
}
if (DidCreate == true)
{
Status = "Mapper blev oprettet..";
Progress = 100;
BGWorker.ReportProgress(100);
}
else
{
Status = "Ingen mapper blev oprettet";
Progress = 100;
BGWorker.ReportProgress(100);
}
}
catch (Exception ex)
{
Status = "Der opstod en fejl ved opstart af programmet, Fejl - MAPPER";
Progress = 100;
BGWorker.ReportProgress(100);
}
}