The problem that I am trying to figure out is: how to populate a listbox with the names of the images, that I have in a folder within my Visual Studio Project? My code so far:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
for (int i = 1; i < 8; i++)
{
ListBox1.Items.Add(System.IO.Path.GetFileNameWithoutExtension(""));
}
}
}
Basically, I have 7 images in a folder(within my actual visual studio project) and I want the for loop to populate the listbox with the names of the images, but without the extension. I can't seem to figure out how to get the directory to work. If anyone could help me, I would greatly appreciate it. I am having trouble with this.
After this, I want to use an 'if' statement to set the image displayed based on which item the user clicks on in the listbox, if that makes sense. I do not know the code for if the item = a certain item, I can display an image based on what they select.
I probably worded this really bad, but it's the issue I am currently experiencing, any help would be greatly appreciated, thank you.