Solved

How can I image load from file to PictureBox

Posted on 2004-04-27
2
1,605 Views
Last Modified: 2012-06-27
Hi,

I am trying load an image from file to PictureBox

How can I load an image from file to PictureBox but on .Net Compact Framework

Example:

filename = " c:\picture.jpg "
PictureBox1.Image = Image.FromFile(filename)

Error :
'FromFile' is not a member 'System.Drawing.Image'.

Thanks for your help.
0
Comment
Question by:Obsolate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
OHDev2004 earned 50 total points
ID: 10927127
try this :

 Dim MyImage As Bitmap
  If Not (MyImage Is Nothing) Then
    MyImage.Dispose()
  End If
 Image1.SizeMode = PictureBoxSizeMode.AutoSize
 filename = " c:\picture.jpg "
 MyImage = New Bitmap((filename))
 Image1.Image = CType(MyImage, Image)

this will load the image from filename into Image1 ,, :P
OHDev2004
0
 

Expert Comment

by:ryanb_9f_com
ID: 11265789
how would I do the same as an if a randomly gernerated number was a given value for a black jack game?  I am using Visual Basic in Visual Studio .Net 2003 Acidemic Edition
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question