Dynamic Control Creation with DHTML Pages? 
Author Message
 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




Mon, 26 Feb 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Dynamic Control Creation with DHTML Pages?

2. Dynamic Control Creation with DHTML Pages?

3. Dynamic Web Page Creation

4. Dynamic Controls Creation and Referencing the new Control.

5. Dynamic Control Creation, Controls object has no .Add ???

6. Dynamic creation of web controls in VB.NET

7. Dynamic Control Creation - Expand Form?

8. Dynamic Creation of Controls

9. Dynamic control creation

10. Dynamic control creation and calling DOS programs from VB.

11. dynamic creation of controls?

12. VB6-Dynamic Control Creation

 

 
Powered by phpBB® Forum Software