Help with the basics

Jixor

Registered Member
Joined
Jan 1, 2012
Messages
86
Reaction score
7
Hello, needing a little help.

I'm creating something using http web requests and iwant it to use different proxies.

So I understand the following:

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

But I would really like to populate the address section using an item from a listbox.

When I do so, VB tells me off because I am trying to convert a string to a webproxy data type.

Can anyone help?

Thanks
 
Thanks for the reply, I tried that except it was ListBox1.Items(x). It didn't work so I've now moved onto c# and it seems to be working so far!

I should've went straight to c# in the first instance, silly me!
 
I am sorry I misread you LOL I was thinking u just wanted to know how to use the text box of whatever to fill it.

To get the item from the listbox you need to use it like this:

Code:
listBox.Items(1).ToString()
 
Yea I added the tostring() in aswell but it was still giving me trouble. I've obviously made a booboo so will probably go back to it so that I can put my mind at ease haha. But for now C# will be used.
 
Code:
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Add("127.0.0.1:80")
        ListBox1.Items.Add("127.0.0.1:3128")
        For x = 0 To ListBox1.Items.Count - 1
            Dim MyProxy As New WebProxy(ListBox1.Items(x).ToString())
        Next

        For Each item In ListBox1.Items
            Dim MyProxy As New WebProxy(item.ToString())
        Next item
    End Sub

Works just fine for me.

Don forget u also need "Imports System.Net"
 
Last edited:
Use the code from the above poster. BTW this thread has got nothing to do with HTTP WEB REQUEST, it's about how to access the string from the listbox. It's better if you post the title of the thread clear to get better help from people.
 
Have placed a sample with For Each and with For ;) they are both working, but If you are just starting with programming C# is way easier to understand and to use over vb.net.
 
Thanks dude! Yea I think I was willing myself to make the switch to c#.

Gave up on it tonight though. Just a quick question and I guess a bit off topic.

Can you actually record a "site visit" with the http web request? I'm saying obviously yes, but it just seems a bit too easy? Either way I'm still doing alot of research on it. I've also ran a test so just waiting to see if it works now.
 
Last edited:
Well it depends on the site but if what you want is for instance, be able to open the site and navigate on it, there are several ways of doing it with http requests, but you might need to use a htmlparser to further gather other urls that you want it to interact with or forms, etc.
 
Seems like you are trying to jump in the deep end without even knowing how to swim...
Learn the language first then move on to the web stuff.
 
Back
Top