I’m planning on creating a program that will have a login form and then a profile for each user. I’ll be putting a picturebox that will display the image of the user.
My problem is how to put a variable in the Image.FromFile(); parameter.
The image will come from a local folder, btw.
Here’s what I would like to do:
- user logs in (ie. user name is stackoverflow)
- on the profile window, an image named stackoverflow.jpg should be displayed.
Is there a way I can do that?
Image.FromFile(“c:\filename.jpg”); <— change the parameter with a variable that will depend on the username of the user.
Why not just have each file saved as the username:
would then return the file associated with that user.
imageDiretorycan be set as a variable so you dont have to change it everywhere in the code if the directory changes where you store the files, and then the username can be determined when the user logs in.