So I'm working on a program "Master Directory Control", it gets all the information about all files in a directory (name, location, size, exists, etc.) and puts them into ListBoxes. That all works fine. There's a feature where you right click on selected file in the Name ListBox, and you can view the file. Viewing text containing files works perfectly, but I'm making an Image viewer for it too, and it opens a new Window to view the picture.
I have to pass the directory and the value of the Selected Item in the "File Name ListBox". That way it can show the picture in the directory + filename (file name is selected from the listbox). So how can I pass those values to the new Window? I've searched and found solutions all over websites, but I can't find any working things...
I've found stuff like:
string idk = this.txtPATH.Text + "\\" + this.listBox.SelectedItem.ToString();
Form Form2 = new Form2();
Form2.Show(); //THIS WORKS, IT OPENS THE WINDOW, BUT THIS DOESN'T:
Image img = idk;
Form2.pictureBox.Image = img;