Click here to Skip to main content
15,921,959 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralHELP!!!!! on Forms Pin
Namboy825-Feb-04 6:26
Namboy825-Feb-04 6:26 
GeneralRe: HELP!!!!! on Forms Pin
John Kuhn5-Feb-04 10:16
John Kuhn5-Feb-04 10:16 
GeneralCOM Interop Attributes Pin
Jim Taylor5-Feb-04 5:45
Jim Taylor5-Feb-04 5:45 
GeneralRe: COM Interop Attributes Pin
Mike Dimmick6-Feb-04 3:34
Mike Dimmick6-Feb-04 3:34 
GeneralRe: COM Interop Attributes Pin
Jim Taylor6-Feb-04 3:47
Jim Taylor6-Feb-04 3:47 
Generalvb.net, timer, run program every 5 mins Pin
Chrissy Callen5-Feb-04 3:09
Chrissy Callen5-Feb-04 3:09 
GeneralRe: vb.net, timer, run program every 5 mins Pin
Ray Cassick5-Feb-04 6:39
Ray Cassick5-Feb-04 6:39 
GeneralRe: vb.net, timer, run program every 5 mins Pin
Chrissy Callen5-Feb-04 23:01
Chrissy Callen5-Feb-04 23:01 
Hi there Smile | :) Ok, the timers seems fine now, next prob is this: I want the program to email only if the file contains new "errors" but NOT to email if there are no new instances of the "error" word. so i wrapped the mail code in if sline <> "" then ... (mail code)...end if and it doesnt seem to mail at all now (i added errors manually to the file to check it). Could u pls tell me where im going wrong? Thanx!

Imports System
Imports System.IO
Imports System.Collections
Imports System.Web


Module Module1


Sub Main()

Dim myTimer As New System.Timers.Timer
Dim LineNo As String
myTimer.Stop()
Dim CurrentLineNo As New Integer
If GetSetting("OrEM", "Settings", "LineNo") = "" Then
SaveSetting("OrEM", "Settings", "LineNo", "1")
End If
LineNo = Val(GetSetting("OrEM", "Settings", "LineNo"))
Dim objReader As New StreamReader("filename")
Dim sLine As String = ""
Dim arrText As New ArrayList

Do
sLine = objReader.ReadLine() : CurrentLineNo = CurrentLineNo + 1
If CurrentLineNo >= LineNo Then
If InStr(UCase(sLine), "MON") Or InStr(UCase(sLine), "TUE") Or InStr(UCase(sLine), "WED") Or InStr(UCase(sLine), "THU") Or InStr(UCase(sLine), "FRI") Or InStr(UCase(sLine), "SAT") Or InStr(UCase(sLine), "SAT") Then
sLine = objReader.ReadLine() : CurrentLineNo = CurrentLineNo + 1
If InStr(UCase(sLine), "ERROR") Then arrText.Add(sLine)
While sLine <> ""
sLine = objReader.ReadLine() : CurrentLineNo = CurrentLineNo + 1

End While
End If
End If
If Not sLine Is Nothing Then

End If
Loop Until sLine Is Nothing
objReader.Close()

If sLine <> "" Then
'create mail notification
Dim mailMsg As New System.Web.Mail.MailMessage
mailMsg.BodyFormat = Mail.MailFormat.Text
mailMsg.To = "me@co.uk"
mailMsg.Subject = "name"
mailMsg.From = "name"

Dim txtBody As String

For Each sLine In arrText
txtBody = txtBody & sLine & vbCrLf
Next

mailMsg.Body = txtBody
System.Web.Mail.SmtpMail.SmtpServer = "server"
System.Web.Mail.SmtpMail.Send(mailMsg)
End If
SaveSetting("OrEm", "Settings", "LineNo", Trim(Str(CurrentLineNo - 2)))
LineNo = Val(GetSetting("OrEM", "Settings", "LineNo"))

CurrentLineNo = 0
myTimer.Interval = 30000
myTimer.Start()
End Sub

End Module


Chrissy Callen
Questionhow to set path? Pin
emmshazi5-Feb-04 2:05
emmshazi5-Feb-04 2:05 
AnswerRe: how to set path? Pin
Dave Kreskowiak5-Feb-04 9:35
mveDave Kreskowiak5-Feb-04 9:35 
GeneralRe: how to set path? Pin
emmshazi6-Feb-04 2:00
emmshazi6-Feb-04 2:00 
GeneralRe: how to set path? Pin
Dave Kreskowiak6-Feb-04 2:50
mveDave Kreskowiak6-Feb-04 2:50 
GeneralTrueDBGrid CellTips question Pin
gpa20004-Feb-04 23:57
gpa20004-Feb-04 23:57 
GeneralRe: TrueDBGrid CellTips question Pin
stepdaddy5-Feb-04 0:33
stepdaddy5-Feb-04 0:33 
GeneralRe: TrueDBGrid CellTips question Pin
gpa20005-Feb-04 2:55
gpa20005-Feb-04 2:55 
GeneralRe: TrueDBGrid CellTips question Pin
gpa20008-Feb-04 20:47
gpa20008-Feb-04 20:47 
QuestionHow to add pictures to your database from the front end Pin
fready4-Feb-04 20:43
fready4-Feb-04 20:43 
AnswerRe: How to add pictures to your database from the front end Pin
Hesham Amin4-Feb-04 22:39
Hesham Amin4-Feb-04 22:39 
GeneralImage Scanning in VB with ADO conrol Pin
praveed4-Feb-04 19:13
praveed4-Feb-04 19:13 
GeneralRe: Image Scanning in VB with ADO conrol Pin
stepdaddy5-Feb-04 0:41
stepdaddy5-Feb-04 0:41 
GeneralRe: Image Scanning in VB with ADO conrol Pin
Dave Kreskowiak5-Feb-04 8:20
mveDave Kreskowiak5-Feb-04 8:20 
GeneralCall a form&#8217;s sub from a Sub Main() Pin
gregcost4-Feb-04 18:32
gregcost4-Feb-04 18:32 
GeneralRe: Call a form&#8217;s sub from a Sub Main() Pin
John Kuhn4-Feb-04 19:49
John Kuhn4-Feb-04 19:49 
GeneralRe: Call a form&#8217;s sub from a Sub Main() Pin
gregcost5-Feb-04 2:28
gregcost5-Feb-04 2:28 
GeneralRe: Call a form&#8217;s sub from a Sub Main() Pin
John Kuhn5-Feb-04 9:31
John Kuhn5-Feb-04 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.