bostonste
asked on
Problem with process.getprocessbyname
I have this sub to check if somthing is running
Sub OnCreated(ByVal source As Object, ByVal e As System.IO.FileSystemEventA rgs)
'MessageBox.Show("On Created")
Dim programName As String = "notepad"
Dim p() As process = process.GetProcessesByName (programNa me)
If p.Length > 0 Then
Exit Sub
Else
If IO.File.Exists("C:\Program Files\Portland Software\Primopost\scanner .exe") Then
System.Diagnostics.Process .Start("C: \Program Files\Portland Software\Primopost\scanner .exe")
End If
End If
End Sub
The problem i have is that process.GetProcessesByName (programNa me) is not a member of process
Can any one tell me what i need to do to sort it out
Sub OnCreated(ByVal source As Object, ByVal e As System.IO.FileSystemEventA
'MessageBox.Show("On Created")
Dim programName As String = "notepad"
Dim p() As process = process.GetProcessesByName
If p.Length > 0 Then
Exit Sub
Else
If IO.File.Exists("C:\Program
System.Diagnostics.Process
End If
End If
End Sub
The problem i have is that process.GetProcessesByName
Can any one tell me what i need to do to sort it out
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is a screen shot, it must be somthing to do with the type of sub it is in but i cant see what it is
Doc1.doc
Doc1.doc
ASKER
i need to be able to see if somthing is running here, any ideas of a better way if if the get process doesnt work
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think the problem is with your declaration..
Try like this:
Dim p() As System.Diagnostics.Process
and then assign...
Try like this:
Dim p() As System.Diagnostics.Process
and then assign...
ASKER
Chaps
Thank you all
Its so easy when you know how isnt it :)
Thank you all
Its so easy when you know how isnt it :)
Type inference is a great thing... I dont know why people hesitate to use it :-)
Dim p() As Process
p = Process.GetProcessesByName