Results 1 to 3 of 3

Thread: error (urgent!!)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Location
    New York
    Posts
    17

    Question 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

  2. #2
    Fanatic Member
    Join Date
    Feb 2002
    Location
    SE England
    Posts
    732
    Try adding the SET keyword..

    Set Image2.picture = LoadPicture("bestand")
    Leather Face is comin...


    MCSD

  3. #3
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    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:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     File1.Path = "C:\My Documents\AAWeb" 'Path to read
    5.     File1.Pattern = "*.jpg" 'pattern to look for
    6. End Sub
    7.  
    8. Private Sub File1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    9.     'Make sure all controls have DragMode set to manual
    10.     If Button = vbLeftButton Then File1.Drag vbBeginDrag 'Start dragging
    11. End Sub
    12.  
    13. Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
    14.     Dim lCounter As Integer 'Loop counter
    15.     Dim lPicture As Integer 'Picture counter
    16.  
    17.     'Delete all pictures to start with
    18.     For lCounter = 0 To Image1.UBound
    19.         Image1(lCounter).Picture = LoadPicture()
    20.     Next
    21.    
    22.     lPicture = 0 'First image to load picture
    23.     With File1
    24.         For lCounter = 0 To .ListCount - 1 'Loop thru all file items
    25.             If .Selected(lCounter) = True Then 'If selected
    26.                 'Load that pic into first image
    27.                 Image1(lPicture).Picture = LoadPicture(.Path & "\" & .List(lCounter))
    28.                 lPicture = lPicture + 1 'Next pic will load into next available image
    29.             End If
    30.         Next
    31.         .Drag vbEndDrag 'Stop the dragging
    32.     End With
    33. End Sub
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width