Solved

How can I image load from file to PictureBox

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 add a minute to the date time value 8 63
add text to end of existing text in file 16 69
VBA color chart bars 12 78
Exit a vb6 apps when a calling it apps closes 15 43
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now