Solved

How can I image load from file to PictureBox

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA open file from excel cell 4 44
using Access 8 75
How to produce a SHA-1 hash function in vb6 in order to save it to a table 8 50
MsgBox 4 68
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

789 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