Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing listboxes via automation
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00186384
Message ID:
00186385
Views:
12
>I'm having a problem accessing the data in a listbox of an html page. I can't seem to get the value for a list box called state. I know if I'm trying to deal with radio buttons code like the following will allow me to select an option:
>
>oie=create('internetexplorer.application')
>oie.navigate('http://superbowl.lycos.com/poll/q1.html')
>oie.document.forms(1).q1(0).click()
>oie.document.forms(1).submit()
>
>However, when encountering a listbox, I can't seem to get a handle on the data in the box. Here's some code that will take you to a page which contains a listbox with states in it:
>
>oie=create('internetexplorer.application')
>oie.navigate('http://www4.ncdc.noaa.gov/cgi-win/wwcgi.dll?WWDI~getstate~USA')
>? oie.document.forms(0).state.selectedindex() && will show 0
>*If you select something else in the box, you will get an index number
>* when you reissue the code -
> ? oie.document.forms(0).state.selectedindex() && will show 0
>
>I've tried several different things, but nothing yields any values.
>? oie.document.forms(0).state(1).text && will show ' '
>? oie.document.forms(0).state(1).value && will show ' '
>? oie.document.forms(0).state(1).title && will show ' '
>
>I saved the html to a local file and opened it in VI to look at the object hierarchy, but still haven't got a clue. Any help is appreciated.


Ok, nothing like the scientific method!< G >

It turns out that the code should have been -
lnindex= oie.document.forms(0).state.selectedindex()
? lnindex
? oie.document.forms(0).state(lnindex).text
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Reply
Map
View

Click here to load this message in the networking platform