I'm completely new to VB.net, and I'm trying to run a semi-intermediate script that checks for certain files being open. When it first opens, it checks for one particular program, then it will continue checking for a different program on a timer.. However; when I run the code, the Sub Timer1 never runs, I have it set to run every 20 seconds..
Imports System.Net
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Process.GetProcessesByName("PROGRAM1").Length >= 1) Then
MessageBox.Show("This Client is already running!", "IG Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Environment.Exit(0)
Else
Process.Start(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "program.exe"))
'''' OPEN PROGRAM ABOVE ''''
End If
For Each frm As Form In Application.OpenForms
frm.WindowState = FormWindowState.Minimized
Next frm
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (Process.GetProcessesByName("PROGRAM2").Length >= 1) Then 'CHECK FOR PROGRAM
MessageBox.Show("Program is running!", "IG Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Environment.Exit(0)
Form3.Show()
Else
MessageBox.Show("Program is not running!")
End If
End Sub
End Class
Above is the code I already have.. my timer sub either isn't running or isn't checking every 20 seconds. Any ideas?