working with images

thexero

Active member
Joined
Jan 27, 2007
Messages
26
Programming Experience
3-5
hi

in the course i am doing, i am required to put a image on the background of a form if certain users log in

but i have a little problem with my code

see attachments

and when i run the program and type in steve, i get an error

i'm not sure if this these errors come up because i'm on an Active Directory domain in a shared folder or not

cheers
 
Well, if you would bother to lookup what GetFolderPath() actually does (it isn't difficult, just right click it and select "Go to definition") you would see that it takes an integer(for the enum value), not a string.
 
hi

thanks for the reply, however, getfolderpath say

(Public Shared Function GetFolderPath(folder As System.Environment.SpecialFolder) As String

when i put my cursor over the top which suggest to me that is accepts string paths not integer paths

and with CurrentDirectory it says this
Public Property CurrentDirectory() As String

i can't seem to find any that say Integer
 
hi

thanks for the reply, however, getfolderpath say

(Public Shared Function GetFolderPath(folder As System.Environment.SpecialFolder) As String

when i put my cursor over the top which suggest to me that is accepts string paths not integer paths

Tell me, why would that suggest to you that it takes strings and not integers?
 
cus it says right at the end of the thing

As String

if i type

(System.Environment.GetFolderPath _
(System.Environment.SpecialFolder.Personal) _
& "\Image.gif")

and but the image in My Documents it works fine so i don't see how it can be integer
 
cus it says right at the end of the thing

As String

if i type

(System.Environment.GetFolderPath _
(System.Environment.SpecialFolder.Personal) _
& "\Image.gif")

and but the image in My Documents it works fine so i don't see how it can be integer

If this is the case then you have a fundamental misunderstanding of how functions work in VB.Net.

The "As String" is the return type, not the parameter type. The parameter type is right there in the definition of the parameter list (which you would have seen if you did what I told you to do) "ByVal folder As System.Environment.SpecialFolder". If you were to go to the definition of System.Environment.SpecialFolder you would see that it is an enum, and thus the parameter is expecting an integer.
 
after some research, i saw exactly what you meant

i couldn't find the answer to easily, so i contacted my course programmer, and he showed me an easy solution to my problem

Form1.imgBackground.Image = Image.FromFile(".\images\steve.jpg")

and it worked fine

thanks for helping me find the answer

cheers
 
Back
Top