Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
ok, I am making a simple program, which is basically has new info everyday. What I am saying is, everyday when you run it, different stuff will appear. Sort of like a news-tracker. What I want is the user to open it and, lets say, a certain image appears (although the image is not built in the program, so It will have to be updated everyday automatically) and i choose the image. how would i go about doing this? It is quite a large question. I've read some books, and still, have no clue how to do this. Thanks. :D
Posted

Is this info. going to be transmitted over to the web? I assume it is since you mentioned something about a news tracker (or did you mean news ticker?).

 

Try using a database + web services.

Gamer extraordinaire. Programmer wannabe.
Posted (edited)
i want it so that i can choose what image they see and what text they see daily. whenever they run the program, yea, transmitted over web... Edited by whosyodaddy
  • Leaders
Posted

from the net , here's an example of putting >> :D << in to a picturebox. you can specify your url's as you want in there.

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim stream As New Net.WebClient()
       Dim sr As IO.Stream = stream.OpenRead("http://www.xtremedotnettalk.com/images/smilies/biggrin.gif")
       PictureBox1.Image = Image.FromStream(sr)
       sr.Close()
   End Sub

  • *Experts*
Posted
If you want to change the URL to the image you could make a simple web service to retrieve the URL or path to the file, or have the program setup to download a small text file which will contain the URL to the image.
Posted

Awesome, but how would you check if the person has an open internet connection?

 

Would you use Try and Catch? And then if there is an error, just close the program?

"Reality is fake, Dreams are for real"
  • *Experts*
Posted (edited)
That would the easiest way, set up a Try...Catch block around the line that download the file and catch the WebException exception. Or, use InternetGetConnectedState API. Edited by mutant
  • *Experts*
Posted

If you dont want to create a web service then go with the file approach.

Try...Catch is an error handling structure. You set it up like this:

Try
   'code that can cause errors here
Catch ex As WebException 'or any other exception you might want
   'handle the error or simple do nothing
End Try

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...