
Dynamic Control Creation with DHTML Pages?
Mark,
you can't add elements to a page as you usually do in VB with .Add or
.Append methods. Only IMG (picture) and OPTION (list item in listboxes)
elements can be created with createElement.
Instead, You should work with DHTML source text stream.
Something like this:
'Add combobox
Document.body.insertAdjacentHTML "beforeEnd", "<select name=cbo " & _
"ACCESSKEY=c datasrc=#dsoCustomers " & _
"datafld=City size=1>"
'Populate combo with values from rs:
Dim oCbo As HTMLSelectElement
Dim oEl As HTMLOptionElement
Set oCbo = Document.All.cbo
Do While Not rs.EOF
Set oEl = Document.createElement("Option")
oCbo.Add oEl
oEl.Value = rs.Fields(0) 'item data
oEl.Text = rs.Fields(1) 'Item text
rs.MoveNext
Loop
I suggest you to download Internet Client SDK from MS site. You'll find
complete docs for DHTML.
HTH,
Alexander Shirshov
Quote:
>I am experimenting with the DHTML designer in VB6 to see if I can
>dynamically add controls to a DHTML page at run-time. One thing I noticed
is
>that there is no Controls collection for the document, rather an Elements
>collection.
>Is there a way to add new elements to the page, I saw the CreateElement
>method, but there is no help on this topic.
>Has anyone tried this or have any comments?
>Thanks,
>--
>Mark J. Brown
>Senior Software Engineer
>Research & Development
>Platinum Software Corporation