Asked by:
How to display image on my form after browsing for it using this code?

Question
-
Hi all
I am using this piece of code to browse for image. And now if any one know How to display image on my form after browsing for it using this code?
P.S. I do't want image to upload to server just to be displayed on user's page
<input id="fileInput" type="file" style="display:none;" /> <input type="button" value="Choose Files!" onclick="document.getElementById('fileInput').click();" />
What I meant is simillar to the the following coded
Dim ofd As New OpenFileDialog ofd.AddExtension = True ofd.CheckFileExists = True ofd.CheckPathExists = True ofd.Filter = "Image Files|*.jpg;*.bmp;*.png;*.gif" ofd.FilterIndex = 1 ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop ofd.Multiselect = True ofd.RestoreDirectory = True ofd.Title = "Select the files that you want to add to the the list" If ofd.ShowDialog() = DialogResult.OK Then PictureBox1.Image = Image.FromFile(ofd.FileName) End If
Thanks advanced and I really appreciate any help
- Edited by Max45-1 Monday, October 22, 2018 1:11 PM
- Moved by CoolDadTx Monday, October 22, 2018 1:59 PM Winforms related
- Moved by Stanly Fan Monday, October 29, 2018 7:32 AM
Sunday, October 21, 2018 5:12 AM
All replies
-
I think that the image has to be transferred (uploaded) to the server. Then the src attribute of an <img> element can be set to point to the image file on the server.
Visit the next places:
- Proposed as answer by Stanly Fan Tuesday, October 23, 2018 1:51 AM
Monday, October 22, 2018 4:39 AM -
Hi omanxp45-2,
Thank you for posting here.
For your question, what is the type of your project?
Best Regards,
Wendy
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Monday, October 22, 2018 7:33 AM -
Hi omanxp45-2,
Thank you for posting here.
For your question, what is the type of your project?
Best Regards,
Wendy
Hi Wendy,
You welcome.
It's a testing project.
- Edited by Max45-1 Monday, October 22, 2018 1:15 PM
Monday, October 22, 2018 1:15 PM -
Hi omanxp45-2,
What the type of your project is? Windows Forms desktop app? Or ASP.NET WebForms app?
I guess it is a WebForm app, if so, it will be more appropriate to ask your question at ASP.NET Forums.
Or if it is a Windows Form app, please provide more details about how do you browse the image with HTML code.
Thanks for your understanding.
Regards,
Stanly
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- Edited by Stanly Fan Tuesday, October 23, 2018 2:46 AM
Tuesday, October 23, 2018 2:46 AM