Try this:
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
success = false;
error="";
folder = folder.TrimEnd('\\');
try{
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
if (bitmap != null)
{
bitmap.Save(@folder+"\\+fileName+"".png"");
success = true;
}
}
catch(Exception e)
{
error = e.ToString();
success = false;
}