Help in C #
-
Good Day i want to know how can i make in C# , OpenFileDialog then open image from this OpenFileDialog then can publish in my form . Thank You
zidan
Please use intelligent headers, and edit your post rather than double posting
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Good Day i want to know how can i make in C# , OpenFileDialog then open image from this OpenFileDialog then can publish in my form . Thank You
zidan
Hi zidan, try this. Add the code to your form class in a button event handler:
if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { try { pictureBox1.Image = Bitmap.FromFile(openFileDialog1.FileName); } catch (Exception ex) { MessageBox.Show("Unable to load specified image: " + ex.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
Also, set the Filter property of openFileDialog1 to only accept image files, e.g. 'Picture files (*.png;*.jpg)|*.png;*.jpg' Good luck! Rob
"An eye for an eye only ends up making the whole world blind"