Solved

How can I image load from file to PictureBox

Posted on 2004-04-27
2
1,612 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

624 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