|
-
Nov 13th, 2001, 05:13 PM
#1
Thread Starter
Member
One simple l'ine of code stoppin prog to work!! Help!
Adding variable names!
i have this line of code in a vb app:
Picturebox1.Picture = LoadPicture("C:\Matt\Cards\" & RandomCardName & ".bmp")
i want it to load a picturefrom the file
C:\Matt\Cards\Filename.bmp
seen as this file will be randomly choen by an array and stored inthe variabe RandomCardName
now the code above looks for file
C:\Matt\Cards\.bmp
can anyone solve it?? heeeeeelp!
-
Nov 13th, 2001, 05:27 PM
#2
Frenzied Member
if RandomCardName is an integer then u need to write:
CStr(RandomCardName)
so it would look like:
Picturebox1.Picture = LoadPicture("C:\Matt\Cards\" & CStr(RandomCardName) & ".bmp")
Try that
or try
Picturebox1.Picture = LoadPicture("C:\Matt\Cards\" + CStr(RandomCardName) + ".bmp")
-
Nov 13th, 2001, 05:38 PM
#3
Thread Starter
Member
so far i have tried the idea in the first pot, but when i run the code, it says object required, and points to picturebox1.picture
now i have a picture so what is the prob??
-
Nov 14th, 2001, 04:07 AM
#4
Fanatic Member
try "Set PictureBox1.Picture = ....."
Teaudirenopossum.Musasapientumfixaestinaure.
(I can't hear you. There's a banana in my ear)
-
Nov 14th, 2001, 01:22 PM
#5
Thread Starter
Member
Done it!!!
It was own to an error on my part! i was trying to open a picture in Picturebox1.picture yet the comp doesnt call them that! They are set at a default of picture1. cheers for the help though!
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
|