C# windows form application, how to allow user to select thier own picture? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C# windows form application, how to allow user to select thier own picture?

I am creating an application for myself to help me with my work. I need to be able to add images with price and name and also be able to remove them. I have the basics down but are there any source codes to help me figure this out or tutorials.

25th Dec 2020, 6:44 AM
Amr Mashrah
Amr Mashrah - avatar
3 Answers
+ 2
Good question. The Image control does not have a isselected property. It does have a onclick event. If the you use this event, you can create a isselected property yourself, by toggle. You could also use the tag-property. If the images are in a list. You can use a image-listbox. Also have a look at listview It is kind of a advanced topic in winforms, wpf is better suited for this. There are also some third components that can do this, but those are not free.
25th Dec 2020, 9:45 AM
sneeze
sneeze - avatar
+ 1
I have figured it out some of it which includes as a user being able to upload a picture to form using the OpenFileDialog()
25th Dec 2020, 10:17 AM
Amr Mashrah
Amr Mashrah - avatar
+ 1
In your project you need database 1- create a class with parameter you need 2- use entity framework 3- create new form to get data from user 4- use open file dialog and get file name then this code to upload image Bitmap bitmap = new Bitmap(imagePath); Finally Add data to data base
25th Dec 2020, 1:03 PM
hossein B
hossein B - avatar