The system will display one image on PictureBox from the Upload folder(contains multiple images).
After the user clicks on the fail button in Form4 then it will show the Form6 to let the user choose a list of defect categories then click on the BtnAdd_Click()in Form6.
When the user clicks on BtnAdd_Click() in Form6 then the image displays in the PictureBox in Form4 will move to the next image incrementImage().
I want to check whether the BtnAdd_Click() was clicked in Form6 and pass to Form4 to perform the incrementImage() function. May I know how to do this thanks.
Form4.cs
public void incrementImage()
{
nCurrentItem++;
firstImage++;
if (nCurrentItem > nTotalNumber)
nCurrentItem = nTotalNumber;
else if (nCurrentItem < nTotalNumber)
{
Image img;
using (var bmpTemp = new Bitmap(ImageFilenames[nCurrentItem]))
{
img = new Bitmap(bmpTemp);
}
PicBox.Image = img;
}
imgCounter.Text = firstImage.ToString() + " / " + nTotalNumber.ToString();
}
Form6. cs
private void BtnAdd_Click(object sender, EventArgs e)
{
if (listBoxFailCategories.SelectedIndex == -1)
{
MessageBox.Show("Please select any defect category");
}
else
{
var tempDefectCategory = "";
foreach (string item in listBoxFailCategories.SelectedItems)
{
string defectFolder = Path.Combine(Value, item);
File.Copy(Image, Path.Combine(defectFolder, Path.GetFileName(Image)), true);
added = true;
tempDefectCategory = tempDefectCategory + item.ToString() + ",";
FullPathName = Path.Combine(defectFolder, Path.GetFileName(Image));
this.Close();
}
DefectCategory = tempDefectCategory;
File.Delete(Image);
}
}