Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Visual Basic (VB 4/5/6) » Game Programming » drawImage problems


drawImage problemsExpand / Collapse
Author
Message
Posted 7/12/2007 11:03:25 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 7/12/2007 2:33:31 PM
Posts: 1, Visits: 6
 

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)

Post #22456
Posted 7/17/2007 12:12:42 AM


Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 1/28/2008 9:56:29 PM
Posts: 39, Visits: 85
I started a programming class in school about febuary so I'm fairly new to programming too, I use vb6 (1998), so my code might be right, but instead of putting mimage = bitmap.fromfile..., try this "mimage.picture = loadpicture ("thisfile.bmp"). this is what vb6 requires to change the picture during run time.

Hope it works

Post #22507
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Brian, Peter

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 11:53pm