I'm working on a project that on the click of a button a random image for a folder I specified will appear in a specific picturebox.
Here's what I have already:
namespace WindowsFormsApplication12
{
public partial class Form1 : Form
{
Random r = new Random();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile(r.Next(3).ToString() + ".jpg");
}
}
Now how can i add a relative path to this? My hardcoded path is c:/users/ben/documents/visualstudio/projects/projectnet/resources/pictures.
Thanks in advance!