private void btnNext_Click(object sender, EventArgs e) { int serialNo = ImageList.Where(p => p.KeyId == currImageKey).FirstOrDefault().SerialNo; int count = ImageList.Count(); if (serialNo < count) { var currentImage = ImageList.Where(p => p.SerialNo == serialNo + 1).FirstOrDefault(); this.currImageKey = currentImage.KeyId; showImage(currentImage.ImageInfo); } }