Module Processes
Dim x As Integer = 0
Sub Main()
Dim pList() As System.Diagnostics.Process = _
System.Diagnostics.Process.GetProcesses
For Each proc As System.Diagnostics.Process In pList
System.Console.WriteLine(proc.ProcessName & " " & proc.Id)
x += 1
Next
System.Console.WriteLine(vbCrLf + "*** Number of processes: " & x)
System.Console.ReadLine()
End Sub
End Module
-
We are using DOS style for the output. To use Windows style use List menu and change a bit in this code.
Howz this???
Show / List all active Process running in ur system (VB.net)
Tuesday, July 15, 2008Posted by Raghunath J at 6:27 PM 6 comments
Labels: Code Snippets
Get Email IDs from text or string (VB.net)
Public Function GetAllEMailAddresses(ByVal Input As String) As List(Of String)
Dim Results As New List(Of String)
Dim MC As Text.RegularExpressions.MatchCollection = _
System.Text.RegularExpressions.Regex.Matches(Input, _
"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*")
For i As Integer = 0 To MC.Count - 1
If Results.Contains(MC(i).Value) = False Then
Results.Add(MC(i).Value)
End If
Next
Return Results
End Function
-
We use regular expression to find an email id in a text or a sting. And it stores in the list box. I hope you can use this to find email ids. Hope u liked this snippet. If you have any doubts on this ask me.
You can also use this on files. But with little modification.
Posted by Raghunath J at 6:19 PM 1 comments
Labels: Code Snippets