Reputation: 1250
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:
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.
Upvotes: 0
Views: 748
Reputation: 2703
Why not just have each file saved as the username:
Image.FromFile(imageDirectory + username + ".jpg");
would then return the file associated with that user. imageDiretory
can 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.
Upvotes: 3