Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to link image to http://

Posted on 2007-12-03
6
Medium Priority
?
303 Views
Last Modified: 2013-11-26
Hi experts,

I want to display image which located in http://myimages.mysite.com onto PictureBox in VB 2005 forms.
I tried it with following codes with ERROR in line "PictureBox1 = Image.FromFile( http://myimages.mysite.com /upload/pubFilePath)"
Would you please advise me?

Thanks,
HD

    Private Sub PhotoDataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles PhotoDataGridView.CellClick
        If e.RowIndex >= 0 Then
            pubFileName = PhotoDataGridView.Rows(e.RowIndex).Cells("PhotoFileName").Value.ToString
            PictureBox1 = Image.FromFile( http://myimages.mysite.com /upload/pubFilePath) ===> ERROR
        End If
    End Sub
0
Comment
Question by:Takeoutdinner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 18

Expert Comment

by:jcoehoorn
ID: 20397101
Private Sub PhotoDataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles PhotoDataGridView.CellClick
        If e.RowIndex >= 0 Then
            pubFileName = PhotoDataGridView.Rows(e.RowIndex).Cells("PhotoFileName").Value.ToString
            Dim wc As New System.Net.WebClient()
            Dim ms As New IO.MemoryStream(wc.DownloadData("http://myimages.mysite.com /upload/pubFilePath"))
            PictureBox1 = Image.FromStream(ms)
        End If
    End Sub
0
 

Author Comment

by:Takeoutdinner
ID: 20397174
Hi expert,
This PictureBox1 = Image.FromStream(ms) has eroor message:
Value of Type 'System.Drawing.Image' cannot be converted to 'System.Windows.Forms.Picture'

What should I do ?

Thanks,
0
 
LVL 18

Expert Comment

by:jcoehoorn
ID: 20397610
Oops.  Change it to:
PictureBox1.Image = Image.FromStream(ms)
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:Takeoutdinner
ID: 20397730
Hi expert,

When I run it, I have this error message "URI formats are not supported" at "           Dim ms As New IO.MemoryStream(wc.DownloadData("http://sunenergy.oncmc.com /upload/pubFilePath"))"

Your kid advice would be appreciated.

Thanks,

0
 
LVL 18

Accepted Solution

by:
jcoehoorn earned 200 total points
ID: 20398095
I just copy/pasted the url you were using.  Looking at it now more closely, I see two things:
1)  You have an extra space in your url.
2)  You don't specify a file name.  Did you mean to use pubFileName from above?

Try this:
IO.MemoryStream(wc.DownloadData("http://sunenergy.oncmc.com/upload/pubFilePath/" & pubFileName))
0
 

Author Comment

by:Takeoutdinner
ID: 20398190
Thanks expert!
It's working fine with this:

          Dim ms As New IO.MemoryStream(wc.DownloadData("http://sunenergy.oncmc.com/upload/" & pubFilePath))
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question