Hi Max,
Sorry I didn't see your post until now.
The answer is yes, of course.
You'll want to start something like this:
Dim dirinfo As New DirectoryInfo("h:\tavo\vwsales\")
Dim finfo As FileInfo() = dirinfo.GetFiles("vw*.dbf")
Dim finfo_ As FileInfo
Dim larraylist As New ArrayList
For Each finfo_ In finfo
larraylist.Add(finfo_.Name)
Next
Then you can sort it, get the name of the first item, send it in an email as
an attachment, and then delete it. The email part: begin by using an
imports statement at the top of the module (above the class):
Imports System.Web.Mail
Then, in perhaps the click event of the button that will launch this:
Dim msg As New MailMessage()
msg.To = "be*****@optonline.net"
msg.From = "be*****@cherwellinc.com"
msg.Subject = "test subject"
msg.Body = "this is the test info"
Dim astring1 As String = "c:\my documents\wzo letter.doc"
msg.Attachments.Add(New MailAttachment(astring1))
Dim astring2 As String = "c:\my documents\visual basic notes.doc"
msg.Attachments.Add(New MailAttachment(astring2))
msg.Cc = "we*******@cherwellinc.com"
SmtpMail.SmtpServer = "smtp.registeredsite.com"
Try
SmtpMail.Send(msg)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
HTH,
Bernie Yaeger
"Max Bialystock" <ca******@legs.com> wrote in message
news:uP*************@tk2msftngp13.phx.gbl...
Is it possible to take the first file in a folder (as sorted by name),
email it to someone, then move the file to a separate directory?
Any help at all will be much appreciated.
Thanks,
Max