Community developer blogs

When you can't google it, you blog it

Website

Recent Posts

  • How to start a process with a different username in vb.net

    Posted: 10 May 2006 at 15:16 by Peter

    Function ConvertToSecureString(ByVal str As String) Dim password As New SecureString For Each c As Char In str.ToCharArray password.AppendChar(c) Next Return password End FunctionSub Main() dim username as string = "Administrator" dim password as SecureString = ConvertToSecureString("my password") d

  • How to empty the recycle bin

    Posted: 06 May 2006 at 14:15 by Peter

    After 6-7 hours with googleing i finally found out how to empty the recycle bin in VB.net using the windows api.Usage:Dim Action As New ShellActionsAction.EmptyRecycleBin()Public Class ShellActions Shared Function _ SHEmptyRecycleBin(ByVal hWnd As Integer, ByVal pszRootPath As String, _ ByVal dwFlag

  • How to validate an IPaddress

    Posted: 02 May 2006 at 17:26 by Peter

    Usage:if(IsValidIPAddress("127.0.0.1") = True) Thenmessagebox.show("The ipaddress is valid.")elsemessagebox.show("The ipaddress is invalid. This might be hostname, try to resolve it.")end ifPublic Function IsValidIPAddress(ByVal str As String) As Boolean Dim r As Regex = New Regex("((2[0-4]\d|25[0-5

  • How to sort a listview control in vb.net

    Posted: 27 Apr 2006 at 13:55 by Peter

    Here is an easy way to sort your listview control from ascending to descending.Paste this little snippet into your vb.net editor:Private Sub Listview1_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles Listview1.ColumnClick With Files .Sort() .Columns(e

AddThis