Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I open an Image and load it to a "picturebox" in ASP

1 view
Skip to first unread message

Rishi Boparai

unread,
May 5, 2008, 3:01:33 AM5/5/08
to
Hi,

in Visual Studios there's this tool called PictureBox rite...but in
Visual Web developer i can't seem to find it..

i'm using Visual Web Developer...VB language..to make a watermarking
script so firstly i need to be able to load the picture i want to the
page first..

in VS the code is
Private Sub BrowseToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
BrowseToolStripMenuItem.Click

OpenFileDialog1.Title = "Select an image ..."

OpenFileDialog1.Filter = "JPEG files|*.jpg" + "|Enhanced Windows
MetaFile|*.emf" + "|Exchangeable Image File|*.exif" + "|Gif Files|
*.gif|Icons|*.ico|Bitmap Files|*.bmp" + "|PNG Files|*.png|TIFF Files|
*.tif|Windows MetaFile|*.wmf"
OpenFileDialog1.FilterIndex = 1

OpenFileDialog1.FileName = ""

OpenFileDialog1.ShowDialog()

SourceFile = OpenFileDialog1.FileName.ToString()

PictureBox1.Image = Image.FromFile(SourceFile)
SourceFile = Me.OpenFileDialog1.FileName

Watermark.OpenImage(OpenFileDialog1.FileName.ToString)

End Sub

I know OpenFileDialog is used in VS and FileUpload is used in VWD
instead..

So wad so ihave to use in VWD instead of PictureBox?

Basically how do i open the image and load it to a "PictureBox"??

PLZ help..Advance thanks

Peter Bucher [MVP]

unread,
May 5, 2008, 4:11:50 AM5/5/08
to
Hello Rishi

> So wad so ihave to use in VWD instead of PictureBox?
>
> Basically how do i open the image and load it to a "PictureBox"??

OpenFileDialog doesnt exists in ASP.NET Environment.
User FileUpload instead.

Also a PictureBox isnt available. Use a Image Control or simply an <img....
Tag instead.

There are several differences between an web- or desktopapplication,
be sure to care about these differences to avoid further problems.

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET

0 new messages