I am trying to when my user scan image it check how many image in folder and then add +1 image to that folder and save. Please help me where am i wrong in below code cos it scan and save but not add in folder
Code:
Private Sub vstwain1_PostScan(ByVal flag As Long)
If flag <> 0 Then
If vstwain1.errorCode <> 0 Then
MsgBox vstwain1.errorString
End If
Else
Dim lnFileCount As Long
Dim sphotocount As Long
Dim sPhotoFile As String
Dim sNewFile As String
sPhotoFile = Dir(sPhotoPath & "\photo *.jpg")
lnFileCount = lnFileCount + 1
sNewFile = sPhotoPath & "photo" & (lnFileCount) & ".jpg"
Set Image1.Picture = vstwain1.GetCurrentImage
If vstwain1.SaveImage(0, sNewFile) = 0 Then
MsgBox vstwain1.errorString
End If
End If
End Sub
thanks
Last edited by Siddharth Rout; Aug 29th, 2012 at 03:47 AM.
Reason: Added Code Tags
First you need to determine number of files in a specified directory - there are few methods ubt perhaps simplest one would be to use FileSystemObject.
In your case using function from that link may look like this:
Code:
lnFileCount = GetFileCount(sPhotoPath) + 1
'rest of your code goes here...