hi,

I want to use Proxy with web browser. I got Code which i found some where in vb forums. Here is Code.
Code:
Imports System.Net
Public Class form1
    ' The structure we use for the information
    ' to be interpreted correctly by API.
    Public Structure Struct_INTERNET_PROXY_INFO
        Public dwAccessType As Integer
        Public proxy As IntPtr
        Public proxyBypass As IntPtr
    End Structure

    ' The Windows API function that allows us to manipulate
    ' IE settings programmatically.
    Private Declare Auto Function InternetSetOption Lib "wininet.dll" _
    (ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, _
     ByVal lpdwBufferLength As Integer) As Boolean

    ' The function we will be using to set the proxy settings.
    Private Sub RefreshIESettings(ByVal strProxy As String)
        Const INTERNET_OPTION_PROXY As Integer = 38
        Const INTERNET_OPEN_TYPE_PROXY As Integer = 3
        Dim struct_IPI As Struct_INTERNET_PROXY_INFO

        ' Filling in structure
        struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
        struct_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy)
        struct_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local")

        ' Allocating memory
        Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))

        ' Converting structure to IntPtr
        System.Runtime.InteropServices.Marshal.StructureToPtr(struct_IPI, intptrStruct, True)
        Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
    End Sub

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 Dim sr As New StreamReader("d:\p.txt")
        Dim ar As New ArrayList
        While sr.Peek <> -1
            ar.Add(sr.ReadLine.ToString)
        End While
        Dim rn As New Random
        Dim pr As Integer
        pr = rn.Next(ar.Count)

        RefreshIESettings(ar.Item(pr).ToString)
 ListBox1.Items.Add(ar.Item(pr).ToString)
        WebBrowser1.AllowNavigation = True
        WebBrowser1.AllowWebBrowserDrop = True
        WebBrowser1.ScriptErrorsSuppressed = True
        System.Threading.Thread.Sleep(5000)
        WebBrowser1.Navigate("http:\\www.whatismyip.com")
Its not Working for me.. Please Help me. Random Proxy is added correctly in Listbox. Please Help me I will Add Rep.