A1VBCode Forums

drawImage problems


http://www.a1vbcode.com/vbforums/Topic22456.aspx

By BTowal - 7/12/2007

 

Hi, i'm completely new to VB but not at all new to programming. I'm trying to create a very basic first program with Visual Basic .Net 2005 but keep getting an error that I have no idea how to handle.

My code:

Public Class Form1

Private mImage As Image

Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

mImage = Bitmap.FromFile("C:\valve2.bmp")

e.Graphics.DrawImage(mImage, 5, 5)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

End Class

 

My error:

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

This error targets line 4, the "mImage = ..." part. The image exists and is located where I declare it to be. I have a form and a panel in design view. I don't know what else is wrong, but the troubleshooting tells me to use "isolated storage" (no idea what that is) or obtain/follow security permissions. Can anyone help?

(When i strip the program down to just that line --the mImage assignment line-- i get the error even then)

By shanewipe - 1/9/2011

Hi friends, I am first time here and really found it good by all means, Infact the topic is good to read and and sending this page to my other firends because they are always asking me for the good resources to read out.



hmmm, I really wonder that why these things are not found in books? well you done a great job really and its been a very handy set of information i had from ur articles. thanks dude. Cheers