Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


drawImage problems


drawImage problems

Author
Message
BTowal
BTowal
Forum God
Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)Forum God (521 reputation)

Group: Forum Members
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)


DevinM
DevinM
Forum God
Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)Forum God (9.1K reputation)

Group: Forum Members
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

shanewipe
shanewipe
Forum God
Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)Forum God (517 reputation)

Group: Forum Members
Posts: 1, Visits: 2
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


E20-611

HH0-110

HP0-S23

HP2-E31

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search