Hi i’m doing a simple image viewer in C#. It has 3 button first button contain “Open” and the last two button is “Back and Next” and the picturebox. I’m done with the open button using OpenFileDialog Here’s my code in OpenFiledialog:
private void openButton_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "JPEG|*.jpg|Bitmaps|*.bmp";
if(openFileDialog.ShowDialog()== DialogResult.OK)
{
pictureBox1.Image = Bitmap.FromFile(openFileDialog.FileName);
}
}
Now this is the problem i don’t have idea what code can i use the in “next and back” button. i know it’s looping. Need you’re help guys thank you..
Here’s working user control code. You’ll need to create new Window Forms Application, create user control called MyPictureViewer. Add pictureBox, and 3 buttons to this control.
Paste below code to this usercontrol codebehind, hook click events, and add this control to main form. Hope this helps