2

I am using http web requests and want it to use different proxies.

This is my starting point:

Dim myproxy As New WebProxy("http://1.1.1.1:80")

I would like to populate the address section using an item from ListBox.

VB does not let me do it, because I am trying to convert a string to an address data type.

Is there a way?

Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
Thomas Pollock
  • 405
  • 1
  • 3
  • 11
  • `"http://1.1.1.1:80"` is a string, not an address type, so you should be able to feed that into WebProxy when it's being created. So not sure what exactly fails with your approach? Could you post some code? – Victor Zakharov Nov 18 '12 at 18:57
  • Hi, thanks for the reply. I've managed to resovle this using C#. Basically I had the above code but instead of the proxy address I had lstproxy.items(x). Where x was an integer defind at the start. But it didn't like the fact I was trying to use a string... Nevermind and thanks for the reply though :) – Thomas Pollock Nov 18 '12 at 19:11

2 Answers2

1

If you managed to solve your problem with the C# code you posted, VB could look like this:

Dim prx As String = "http://" & lstProxy.Items(x)
Dim myProxy As New WebProxy(prx)

And if you write same in C#, there is hardly any difference.

Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
0

Ok - could not figure it out! But have since switched to C#.net and it's all good.

I've handled it like this:

       string front = "http://";
       string prx = front + lstProxy.Items[x].ToString();

       WebProxy myProxy = new WebProxy(prx);

So, top advice from me is to get C#.Net. Feel free to comment on this if any help is needed.

Thomas Pollock
  • 405
  • 1
  • 3
  • 11
  • I am a VB.NET programmer, as you can infer from my profile. So switching to C# is not a good excuse. How exactly VB.NET did not work in above scenario? From my experience, VB.NET is much more simple for starters, and you generally get stumped less often. – Victor Zakharov Nov 18 '12 at 19:15