Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to generate an image from a url and load it into a picturebox, but I keep getting an invalid parameter error on my URL. I am attempting to use google maps and had an entire map path, but dropped it down to just the maps URL and still getting the error. Can someone let me know what is wrong with my code:

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       'LoadWebImageToPictureBox(PictureBox1, "http://maps.google.com/?q=113+gunn+road" & Chr(44) & "+centerville" & Chr(44) & "+ga" & Chr(44) & "+31028&z=2&t=h")
       Try
           Dim req As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create("http://maps.google.com/?q=1113+watson+blvd,+warner+robins,+ga,+31028&z=2&t=h"), Net.HttpWebRequest)
           Dim res As Net.HttpWebResponse = DirectCast(req.GetResponse, Net.HttpWebResponse)

           Dim img As Image = Image.FromStream(res.GetResponseStream)

           res.Close()

           PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
           PictureBox1.Image = img
       Catch ex As Exception
           MessageBox.Show(ex.Message)
       End Try
       PictureBox1.Image = New System.Drawing.Bitmap(New IO.MemoryStream(New System.Net.WebClient().DownloadData("http://www.google.com/")))

   End Sub

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Posted

Dont know what you are trying to do... but you are trying to convert an HTTP stream into a picture. The link that you are building is a link to an HTML page. Not a picture.

 

You might take a look through the API

http://www.google.com/apis/maps/

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

I looked at that, but I am wanting to put the map in a picturebox on a winform, not an asp page, so that does not really help because it is for a web page. I had read a couple of articles that said you can convert the webpage to a bitmap and display it that way using a picturebox which is what I was attempting to do.

 

Chester

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...