Link to home
Start Free TrialLog in
Avatar of Jason Yousef
Jason YousefFlag for United States of America

asked on

SIMPLE Add E-mail After completion to to VB.net Code

Hello All,

I've this code that was created by a previous contractor, and he left the company in the middle of the development, to cut the story short ...it's a simple application to run stored procedures to import 5 TXT files into SQL server 2005 Express and then export it into one TXT file using a specific format.

ALL what we need is to add an E-mail notification feature upon completion of the task, just to make sure that it has ran and processed a file that has data.

So the E-mail IF possible need to include size and name of the file, time and date...

I'll open a second related question to separate the points, when this question done, so we can add a backup feature to move the created file after a week to another folder

Thanks in advance and god bless anybody who share the knowledge
Form1.vb
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
regarding your second question i'd create a task scheduler which will copy the file in week time to a designated folder.
creating task scheduler in .net can be created in 2 ways:
1. using Process to run task scheduler tool (schtasks.exe)
2. using Interop.NetFwTypeLib.dll to create task schedulers.
Avatar of Jason Yousef

ASKER

sedgwick,

Thank you for your reply, actually I found many snippets to send e-mail from VB application, but my problem is how to merge that in the application to send mail when the task is completed and weather the file is ZERO bites or not ?

so it's an E-mail notification feature upon completion of the task, just to make sure that it has ran and processed a file that has data.

also the E-mail IF possible need to include size and name of the file, time and date...

Thanks
>>but my problem is how to merge that in the application to send mail when the task is completed and weather the file is ZERO bites or not ?

i'm not sure i understand the problem here. when task is completed u create the email and send it.
what do u mean by merge that in the application?

btw, all the data u mentioned (file size, time and date etc) can be added to the body of the email.

sedgwick,

I mean integrate it in the application by merging it.
I don't know how to send the mail after task completion.

can you provide me with MY CODE + YOURS  to compile the application?


Thanks
Jason
what is the last function called when executing the task?
I don't really know, i'm not a programmer, but from looking at the code, looks like it's "Sub WriteText()"
without disrespect, how would u check his code if u not a programmer?
even with code i'll post u might wanna have someone to check it ...
anyway, a task complete is when user closes the form or when timer is disabled?
what is considered to be task completed?
sedgwick,

I've the source code for the application

did you look at the attached VB code?   in the original post?

Task completed when the file is created and the form is closed, which it does close automatically.

Please look at the code, it'll give you a better understanding of the application

Thanks
i looked at the code and i think that in that case u should add FormClosing event handler and put the email code there.
something lie:

    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        SendEmail()
    End Sub
    Private Sub SendEmail()
        ''sending email code...
    End Sub
Thanks, will try it and tell you the results, thanks again.
have a wonderful day or night wherever you're :)
@huslayer

u2 mate ;-)

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for all your help...God Bless you and your families for sharing the knowledge....