I'm implementing an application that :
loads images from "My Picture" folder to a panel automatically when the form is loaded. (You can find the code here)
There's another function in my program which is: Open folder, that enables the user to open a folder to load its images to the same panel too.
My question is: When ever I choose to open a new folder, the images of this folder appears under the images of "My Picture" folder, I know what is the problem but I don't know how to solve it.
The code for loading the images automatically from "My Picture" contains a variable called Position that defines the position of the current PictureBox control and it's initial value is 0.
//2 variables, one for the Y position of the current PictureBox control
//and one for help count the number of images in the directory
int position = 0;
int count = 0;
the code for Open Folder is the same code I used in loading the images from My Pictures, and position initial value is 0 too! thats why the new loaded images appears under the old ones.
private void openFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Getting files.....";
int position = 0;
int count = 0;
how can I fix this problem? I thought of saving the position of latest created PictureBox and use it then as initial value in private void openFolderToolStripMenuItem_Click
Thanks!