none
How to display image on my form after browsing for it using this code?

    Pertanyaan

  • 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

    Minggu, 21 Oktober 2018 05.12

Semua Balasan

  • 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:

     


    Senin, 22 Oktober 2018 04.39
  • 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.

    Senin, 22 Oktober 2018 07.33
  • 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.



    • Diedit oleh omanxp45-2 Senin, 22 Oktober 2018 13.15
    Senin, 22 Oktober 2018 13.15
  • 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.

    Selasa, 23 Oktober 2018 02.46