Atul Rokade

Atul Rokade

  • NA
  • 141
  • 43.6k

how to auto increment jpg

Oct 1 2016 2:20 AM
Hi all,
 
  Following code is storing one image after program run that image is base one Username_and current date , now what i want whenever same user put his detail at same day at that time his existing image of name and date should be increment like 1st time name should be john_1-10-2016, same user put his detail again then image should be john_1-10-2016(1),john_1-10-2016(2) and so on 
 
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);
var date = DateTime.Now.ToString("dd-MM-yyyy");
string format = txtname.Text += date;
bitmap.Save(@"E:\\Project backups\\Medical\\Sales_receipt\\" + format + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
 

Answers (2)