Private Sub ChangeProxy(ByVal IP As String, ByVal Proxy As Boolean, ByVal strAddress As String, ByVal ByPass As Boolean)
Dim strComputer
Dim strUserName
Dim strPassword
Dim objLocator
Dim objService
Dim objRegistry
Dim strKeyPath, strValueName, strValue As String
Dim dwValue As Integer
Const HKEY_CURRENT_USER = &H80000001
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
strComputer = IP
strUserName = UserName
strPassword = Password
Try
objLocator = CreateObject("WbemScripting.SWbemLocator")
If (IP = System.Environment.MachineName) Then
objService = objLocator.ConnectServer(strComputer, "Root\Default")
Else
objService = objLocator.ConnectServer(strComputer, "Root\Default", strUserName, strPassword)
End If
objService.Security_.impersonationlevel = 3
objRegistry = objService.Get("StdRegProv")
strValueName = "ProxyEnable"
If (Proxy) Then
dwValue = 1
objRegistry.SetDWORDValue(HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue)
strValueName = "ProxyServer"
strValue = strAddress
objRegistry.SetStringValue(HKEY_CURRENT_USER, strKeyPath, strValueName, strValue)
If (ByPass) Then
strValueName = "ProxyOverride"
strValue = txtByPass.Text
objRegistry.SetStringValue(HKEY_CURRENT_USER, strKeyPath, strValueName, strValue)
'Else
' strValueName = "ProxyOverride"
' strValue = "127.0.0.1"
' objRegistry.SetStringValue(HKEY_CURRENT_USER, strKeyPath, strValueName, strValue)
End If
Else
dwValue = 0
objRegistry.SetDWORDValue(HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue)
End If
CreateLog("Proxy Setting for IE", IP, "Proxy Address " & strValue & " Executed.", "Success")
Catch ex As Exception
CreateLog("Proxy Setting for IE", IP, "Proxy Address " & strValue & " Executed.", "Failed")
End Try
End Sub
Introduction Paging and Sorting are most commonly used features of ASP.Net GridView. And it is very easy to implement in GridView with small lines of code. Here I am going to demonstrate how to use Paging and Sorting in GridView for better use of data display.