473,412 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Loading an image

Hi,
I have a browse button, where I am selecting an image. How can I
load it into a PitctureBox?
Thanks in Advance
Nov 16 '05 #1
3 1710
Xarky,

I assume you mean you have selected a file from the textbox. If you
want an image, you can pass the filename to the constructor of the Bitmap
class, and pass that to your PictureBox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I have a browse button, where I am selecting an image. How can I
load it into a PitctureBox?
Thanks in Advance

Nov 16 '05 #2
If you have browser button which shows the file dialog --> use
Image.FromFile (string filename) to load it into the PictureBox.

OpenFileDialog dlg = new OpenFileDialog();

if (dlg.ShowDialog (this) == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile (dlg.FileName);
}

Regards,
Peter Jausovec
(http://blog.jausovec.net)
Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> je napisal
v sporoèilo news:%2****************@TK2MSFTNGP10.phx.gbl ...
Xarky,

I assume you mean you have selected a file from the textbox. If you
want an image, you can pass the filename to the constructor of the Bitmap
class, and pass that to your PictureBox.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I have a browse button, where I am selecting an image. How can I
load it into a PitctureBox?
Thanks in Advance


Nov 16 '05 #3
Hi,

I assume that the button create a OpenFileDialog where the user can browse
for the file, if so you get the result from it using the FileName property,
if so all you have to do is create a Bitmap from that file and assign it to
the picturebox

you will have to take care of the size of the image though.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I have a browse button, where I am selecting an image. How can I
load it into a PitctureBox?
Thanks in Advance

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: OneSolution | last post by:
Hi All, Here's what I'm trying to do. I have a diverse customer base, and as it grows, it's increasingly harder to figure out what aspect of our web site is selling and what is not. So I've...
4
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just...
4
by: zborisau | last post by:
Hey good people, I've been given a problem to solve recently - and stuck with the solution for a good 4 days already. i have a link which leads to popup window. the purpose of that popup...
6
by: Ivan Bútora | last post by:
I have recently looked at http://alistapart.com/articles/imagegallery to implement a simple picture gallery on a webpage that I'm working on. Everything works fine; however, I have one question....
5
by: toffee | last post by:
Hi all, I've seen a really cool effect which i would like to use on an intranet site. Am referring to the 'LOADING..' animation you see when switching pages. I've seen it somewhere on a website...
0
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and...
1
by: agatha.life | last post by:
I did a javascript for the loading of images (I didn't want to have the images loaded in "on loading" because they are too many). The website is for a model and if you look at the codeof pages (...
5
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
We have a page that is loading very slow. There is not a lot of data, not a lot of users are connected at the same time and the page does not produce an error, so I am not sure where to start to...
1
by: mlikesit | last post by:
I am trying to get the following code to pre-load some images before re-dirrecting the user. The problem is that the onError event gets called for all of the images immediately. I've tripple...
4
by: Sophy | last post by:
Hi folks, Now, I am facing problem with canceling image loading. I have tried: var img = new Image(); img.src = "path/to/the/image"; // and then I set the img.src to another source
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.