We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

You can use this code to save the screenshot when there will be any possibility of error in the application .If the client is using the application developer can ask the client to send the screenshot so that he can know in which page the error was occured
 
 
   To take the screenshot
                  
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
 
   Graphics graphics = Graphics.FromImage(bitmap as Image);
 
   graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
 
   bitmap.Save("c:\\screenshot.jpeg", ImageFormat.Jpeg);.
To send it through email
  
        public void SendAttachedEmail(string to, string subject, string path)
        {
            //To connect the SMTP server for mailing.
            try
            {
                MailMessage objMailMsg = new MailMessage(EmailSender, to);
              
                objMailMsg.Subject = subject;
                Attachment objAttachment = new Attachment(path);
                objMailMsg.Attachments.Add(objAttachment);
        System.Net.Mail.SmtpClient objSmtpClient = new SmtpClient("192.168.10.1", 25);
                objSmtpClient.Send(objMailMsg);
            }
            catch (Exception ex)
            {
               throw ex;
            }
        }


Related Tags:

C#

Author: Premananda Das

top

C#

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login