|
-
Mar 4th, 2002, 02:36 AM
#1
Thread Starter
Junior Member
error (urgent!!)
i have a filebox that only shows image files and i have 10 image control.
This should happen:
I select a few files i drag the filebox and I drop it on the image controls and the images(selected files in the filebox) are shown in the imagecontrols
this is my code I use to place the image files in the image-controls by drag & drop
Private Sub Image2_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Set Image2.picture = Nothing
i = 0
For i = 1 To File1.ListCount - 1
If Source.Selected = True And i < Image2.Count Then
bestand = Dir1.Path & "\" & File1.FileName
Image2.picture = LoadPicture("bestand") 'laden van het bestand in imagecontrol
i = i + 1
End If
Next i
End Sub[FONT=courier new][FONT=courier new]
but i get stil an error 'method or data member not found' and the problem should be on image2.picture or is it something else or have i forgotten something
-
Mar 4th, 2002, 03:14 AM
#2
Fanatic Member
Try adding the SET keyword..
Set Image2.picture = LoadPicture("bestand")
Leather Face is comin...
MCSD
-
Mar 4th, 2002, 03:23 AM
#3
PowerPoster
Hi
That isnt the prob Leather.. there are quite a few including using the same 'i' variable for a loop and a picture counter. Anyway I threw together a quick sample. You can add error mgt and other niceties
VB Code:
Option Explicit
Private Sub Form_Load()
File1.Path = "C:\My Documents\AAWeb" 'Path to read
File1.Pattern = "*.jpg" 'pattern to look for
End Sub
Private Sub File1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Make sure all controls have DragMode set to manual
If Button = vbLeftButton Then File1.Drag vbBeginDrag 'Start dragging
End Sub
Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Dim lCounter As Integer 'Loop counter
Dim lPicture As Integer 'Picture counter
'Delete all pictures to start with
For lCounter = 0 To Image1.UBound
Image1(lCounter).Picture = LoadPicture()
Next
lPicture = 0 'First image to load picture
With File1
For lCounter = 0 To .ListCount - 1 'Loop thru all file items
If .Selected(lCounter) = True Then 'If selected
'Load that pic into first image
Image1(lPicture).Picture = LoadPicture(.Path & "\" & .List(lCounter))
lPicture = lPicture + 1 'Next pic will load into next available image
End If
Next
.Drag vbEndDrag 'Stop the dragging
End With
End Sub
Regards
Stuart
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
|