Link to home
Start Free TrialLog in
Avatar of bbh2k3
bbh2k3

asked on

Help Getting values from an HTML selectbox

Hello Experts!
I need a code to get the value from a HTML a html selectbox..

<option value=example1>example2</option>
i need the example1 value and example2 value
Can this be done by using WebBrowserComponent ?
Thanks in Advance!
Avatar of shaneholmes
shaneholmes

You can drop a TWebBrowser on your form, you will then have to import the MS HTML control Type Library (Do you know how to do this?)

Use the code below to get to the document

procedure TForm1.Button1Click(Sender: TObject);
var
 Document: IHTMLDocument2;
begin
 WebBrowser1.Navigate('Your Url Here');
 Document:= WebBrowser1.Document as IHTMLDocument2;
end;

From here I can help you get to a particular Form Eleement - do ou know its name or ID?

Shane
Avatar of bbh2k3

ASKER

Shane:
<select name=tophone size=1 tabindex="3">
that's it. i'll now search for the MS HTML control type libs..
Avatar of bbh2k3

ASKER

can you give me some more info about this library ?
CLick component, import Active X

select from list

MS HTML Object Library

and click create unit

then add the unit to your uses clause

uses
  Windows ..........., MSHTML_TLB;


Shane
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bbh2k3

ASKER

Shane thanks, i've been busy a couple of days, i'll try it tonight and accept the answer.