I am trying to consume a web service using VS2008.

The code below works in VS2005 but not VS2008 I, suspecting it's to do with WCF. Please can someone help me to solve the puzzle?

'Old code that works

Dim o As New MyWebService.Name
        Dim pr As New System.Net.WebProxy("", 80)

        pr.Credentials = System.Net.CredentialCache.DefaultCredentials
        o.Proxy = pr

        Dim ds As New DataSet
        ds = o.GetMyData(Me.TextBox1.Text, "password")
        Me.DataGridView1.DataSource = ds.Tables(0)

This is how im trying to do it with no success

Dim o As MyWebService.nameSoapClient = New MyWebService.nameSoapClient()
        o.ClientCredentials = System.Net.CredentialCache.DefaultCredentials.GetCredential('lost here')

        DataGridView1.DataSource = o.GetMyData(Me.TextBox1.Text, "password")

It turns out i could have continued using the original code. But when adding a Web service to a windows application using VS 2008 there's a bit of a change.

When you go to add a web reference (by right clicking on your project then add Service Reference) you are prompted to add a "Service Reference" in VS 2008. Once you have done this you will see an advanced button below click on it. Now put your wsdl link in and press go. Make sure you give your web reference a meaning full name "MyWebService"and then click on Add Reference.

You can now use the code in the original thread

This question has already been answered. Start a new discussion instead.