Saturday, March 24, 2012

Web Service problem

I am using a web service that (given a zip code and a radius) returns movie theaters and movies with times. I have created the reference and coded the following:

Dim Theatre1As com.ignyte.www.MovieInformation =New com.ignyte.www.MovieInformation

Dim theatre2As com.ignyte.www.Theater =Theatre1.GetTheatersAndMovies(txtbxZip.Text, txtbxRadius.Text)

with the underlined area I get the error message: c:\inetpub\wwwroot\JohnHathcock_Unit5IP\WebForm1.aspx.vb(37): Value of type '1-dimensional array .com.ignyte.www.Theater' cannot be converted to .com.ignyte.www.Theater'.
Thanks in advance for your help in this matter.
John Hathcock

The web service is returning an array. Your variable declaration should read
Dim theatre2() As com.ignyte.www.Theater = Theatre1.xxx


That corrected that problem, but now I am having trouble posting the results. Here is what I have:
I did have lstbxtheatre.items.clear()
lstbxTheatre.Items.add(theatre2.Name)
lstbxTheatre.Items.add(theatre2.Address)

'display results

lstbxTheatre.Items.Clear()

lstbxTheatre.Items.Add(theatre2 Name)
and I get this message: 'Name' is not a member of 'System.Array'.

thanks again for your help.
John


Having returned an array of objects, you need to specify which array element you want.

The first one is theatre2(0).Name, the next one will be theatre2(1).Name, etc.


I did that and now I get the error of:

Input string was not in a correct format
The code is as follows:

Dim Theatre1As com.ignyte.www.MovieInformation =New com.ignyte.www.MovieInformation

Dim theatre2()As com.ignyte.www.Theater = Theatre1.GetTheatersAndMovies(txtbxZip.Text, txtbxRadius.Text)

Dim IAsInteger

For I = 0To theatre2.Length - 1

Next

'display results

lstbxTheatre.Items.Clear()

lstbxTheatre.Rows = (theatre2(0).Name)<--Error begins here

lstbxTheatre.Items.Add(theatre2(0).Address)

lstbxTheatre.Items.Add(theatre2(1).Name)

lstbxTheatre.Items.Add(theatre2(1).Address)

0 comments:

Post a Comment