Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Picture Boxes and the NET

FallenFallen Member Posts: 32
Does anyone have any ideas, hot to assign a picture from the net to a picture box at run time?

At the moment, i can get it to display a gif located on the net, but only at design time via the image property on the properties tab. This works like a charm, but when i come to trying this at runtime, i get this message:

An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: URI formats are not supported.

Any ideas on this?

Comments

  • iwilld0itiwilld0it Member Posts: 1,134
    : Does anyone have any ideas, hot to assign a picture from the net to a picture box at run time?
    :
    : At the moment, i can get it to display a gif located on the net, but only at design time via the image property on the properties tab. This works like a charm, but when i come to trying this at runtime, i get this message:
    :
    : An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
    : Additional information: URI formats are not supported.
    :
    : Any ideas on this?
    :
    :



  • iwilld0itiwilld0it Member Posts: 1,134
    : : Does anyone have any ideas, hot to assign a picture from the net to a picture box at run time?
    : :
    : : At the moment, i can get it to display a gif located on the net, but only at design time via the image property on the properties tab. This works like a charm, but when i come to trying this at runtime, i get this message:
    : :
    : : An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
    : : Additional information: URI formats are not supported.
    : :
    : : Any ideas on this?
    : :
    : :
    :
    :
    :
    :

    Try something like ...

    picBox.Image = Image.FromFile("c:somepicture.bmp")
  • FallenFallen Member Posts: 32
    : : : Does anyone have any ideas, hot to assign a picture from the net to a picture box at run time?
    : : :
    : : : At the moment, i can get it to display a gif located on the net, but only at design time via the image property on the properties tab. This works like a charm, but when i come to trying this at runtime, i get this message:
    : : :
    : : : An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
    : : : Additional information: URI formats are not supported.
    : : :
    : : : Any ideas on this?
    : : :
    : : :
    : :
    : :
    : :
    : :
    :
    : Try something like ...
    :
    : picBox.Image = Image.FromFile("c:somepicture.bmp")
    :

    Yeah that what i was doing, the fromFile only works with local files, not URLs. But i have found a way around this, and now it works perfectly :) thanks anyways
  • iwilld0itiwilld0it Member Posts: 1,134
    : : : : Does anyone have any ideas, hot to assign a picture from the net to a picture box at run time?
    : : : :
    : : : : At the moment, i can get it to display a gif located on the net, but only at design time via the image property on the properties tab. This works like a charm, but when i come to trying this at runtime, i get this message:
    : : : :
    : : : : An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
    : : : : Additional information: URI formats are not supported.
    : : : :
    : : : : Any ideas on this?
    : : : :
    : : : :
    : : :
    : : :
    : : :
    : : :
    : :
    : : Try something like ...
    : :
    : : picBox.Image = Image.FromFile("c:somepicture.bmp")
    : :
    :
    : Yeah that what i was doing, the fromFile only works with local files, not URLs. But i have found a way around this, and now it works perfectly :) thanks anyways
    :

    Im pretty interested. What was your solution to the URL problem?


  • FallenFallen Member Posts: 32
    : : : : : Does anyone have any ideas, hot to assign a picture from the net to a picture box at run time?
    : : : : :
    : : : : : At the moment, i can get it to display a gif located on the net, but only at design time via the image property on the properties tab. This works like a charm, but when i come to trying this at runtime, i get this message:
    : : : : :
    : : : : : An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
    : : : : : Additional information: URI formats are not supported.
    : : : : :
    : : : : : Any ideas on this?
    : : : : :
    : : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : :
    : : : Try something like ...
    : : :
    : : : picBox.Image = Image.FromFile("c:somepicture.bmp")
    : : :
    : :
    : : Yeah that what i was doing, the fromFile only works with local files, not URLs. But i have found a way around this, and now it works perfectly :) thanks anyways
    : :
    :
    : Im pretty interested. What was your solution to the URL problem?
    :
    :
    :

    Like so:

    Imports System.Net

    Dim wc As New WebClient()

    PictureBox1.Image = Image.FromStream(wc.OpenRead("URL"))

    I was looking at much more complicated solutions, and then i spotted the webclient class, and it works like a charm, there is a very small delay when retreiving the picture.

    Hope that helps
    -Fallen

  • Andre YoungAndre Young USAMember Posts: 0

    _ ( http://forcoder.org ) free video tutorials and ebooks about \ MATLAB, C#, Scratch, Swift, Perl, Visual Basic, PL/SQL, JavaScript, Assembly, Java, Go, Delphi, Python, Ruby, R, PHP, C++, Visual Basic .NET, Objective-C, C ML, COBOL, Hack, Scheme, Kotlin, F#, ABAP, Logo, Lisp, Clojure, Fortran, Dart, Bash, Crystal, Julia, SAS, Awk, Transact-SQL, VBScript, Rust, Prolog, LabVIEW, Alice, Scala, Erlang, Apex, Ada, FoxPro, Lua, D \ _________

Sign In or Register to comment.