[RESOLVED] Help - Using While plus IF and image.pictures
Hi all,
I need to get picture by picture from a directory e insert into a image.picture.
One of them could have a size higher, like 598x50, and that picture I need to insert at image(5).picture.
The next loop from the same directory, get another picture and the size is smaller like, if pic < M_Widht(400) then...... insert at image(5).picture.
One more loop from the same Directory, get another picture and the size is smaller like, if pic < M_Widht(400) then...... if image(1).picture has a picture on it go to insert at image(2).picture.
One more loop from the same Directory, get another picture and the size is smaller like, if pic < M_Widht(400) then...... if image(1).picture has a picture and if image(2).picture has a picture on it, go to insert at image(3).picture.
End of pictures, end of loop.
Go to next Directory and start again a new page filling up those image(n).pictures.
I´m trying any If I know, first of all I am a newbie with V.B :o
I would like to thanks any person that will read this topic and help me.
I don´t have any more ideas.
thanks a lot.
Ivan
-----------------
[My code]
Private Sub Detail_Format()
Dim WFD As WIN32_FIND_DATA
'
Dim intLoop As Integer
Dim objControl As Image
'
mstrDirEntrada = "C:\Inetpub\wwwroot\DS\uploads\raat.da\" & Field28.Text & "\"
strMask = mstrDirEntrada & "*.jpg"
hArq = True
hSearch = FindFirstFile(strMask, WFD)
contador = 1
'
FlagImage1 = 0
FlagImage2 = 0
FlagImage3 = 0
FlagImage4 = 0
FlagImage5 = 0
'
Image1.Picture = Nothing
Image2.Picture = Nothing
Image3.Picture = Nothing
Image4.Picture = Nothing
Image5.Picture = Nothing
'
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
Image4.Visible = False
Image5.Visible = False
'
If hSearch <> INVALID_HANDLE_VALUE Then
While hArq
strArquivo = StripNulls(WFD.cFileName)
If Dir(mstrDirEntrada & strArquivo, vbArchive) <> "" And strArquivo <> "." And strArquivo <> ".." Then
dados = mstrDirEntrada & strArquivo
'
' Check Image n return variable m_width size
ReadImageInfo (dados)
' If Size Biger than, image1
If m_Width > 400 And cheio400 = False Then
Image1.Visible = True
Image1.Picture = LoadPicture(dados)
cheio400 = True
End If
If Image2.Visible = False And cheio = False Then
Image2.Visible = True
Image2.Picture = LoadPicture(dados)
cheio = True
End If
If Image2.Visible = True And Image3.Visible = False And cheio = False Then
Image3.Visible = True
Image3.Picture = LoadPicture(dados)
cheio = True
End If
If Image2.Visible = True And Image3.Visible = True And Image4.Visible = False And cheio = False Then
Image4.Visible = True
Image4.Picture = LoadPicture(dados)
cheio = True
End If
If Image2.Visible = True And Image3.Visible = True And Image4.Visible = True And Image4.Visible = False And cheio = False Then
Image4.Visible = True
Image4.Picture = LoadPicture(dados)
cheio = True
End If
End If
contador = contador + 1
hArq = FindNextFile(hSearch, WFD)
Wend
hArq = FindClose(hSearch)
Else
MsgBox "File not found!"
End If
Exit Sub
ERRO:
MsgBox Err.Number & " - " & Err.Description
End Sub
----------------------------------
Thanks guys.
Ivan