|
-
Dec 29th, 2000, 11:21 PM
#1
Thread Starter
Banned
in my program i use an ini and you can set a pic as the backround. but what if the user moves the pic to somewhere else on thier computer? the program crashs. how would i make an err msg come up and make it not load the pic???
-
Dec 29th, 2000, 11:32 PM
#2
Fanatic Member
Use the Dir function to check and see if the path exists..
Code:
If Dir("C:\MyPic.bmp") <> "" Then
LoadBackGround
Else
MsgBox "Your Background Image Was Not Found!", vbOkOnly or vbcritical, "Error!"
End If
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 30th, 2000, 12:33 AM
#3
Thread Starter
Banned
IT DIDNT WORK!!!
i put the code in and the same thing happend. and whats w/ the C:\MyPic.bmp? The user selected the pic and it could be any where w/ any name. the file location is in the ini. is the "LoadBackGround" where i put the code, cause i did. and when i had it in it didnt work!!!
so whats up with this?
-
Dec 30th, 2000, 08:13 AM
#4
Member
That's easy
Why don't you just put somewhere in your program a picturebox with the image you want to load from the ini and set it's visible property to false, then you can load the picture just with
Code:
Picture1.picture = Picture2.picture
-
Dec 30th, 2000, 08:56 AM
#5
Fanatic Member
nukem996,
"C:\MyPic.bmp" is for example purposes only, replace it with the variable that holds the path you received from the INI file and try it again. I am sure that if you tried the code with "C:\MyPic.bmp" then it didn't work.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 30th, 2000, 12:37 PM
#6
Thread Starter
Banned
!?!?!?!?!?!?
i put this code in the way you told me to and in my program it defines pic and loadpicture(pic), but it still dosent work!!! gives me this error, "Bad file name or number," on this line of code "if dir(pic) <> "" Then."
pic = E:\pic\stairs.gif
so what the problem?
code:
If Dir(pic) <> "" Then
'LoadBackGround
frmmedia.Picture = LoadPicture(pic)
Else
MsgBox "Your Background Image Was Not Found!", vbOKOnly Or vbCritical, "Error!"
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|