Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Objects dinamically and access them in VB 6.0

Status
Not open for further replies.

Jagger

IS-IT--Management
Nov 7, 2000
7
0
0
PE
Hi:
I am developing a DHTML based solution in VB 6.0. I have created objects dinamically using the OuterHTML command for adding HTML code to my page.
My problem is that I cannot access those objects (their values and events) from my application after they were created. I used a JavaScript routine in my HTML page for accessing them, but now, I cannot pass those results back to my application.
If you know more about this way or another ones, I hope you can help me.
Thanks.
 
if you given your objects an ID or name, such as <input name=&quot;this control&quot;>

you can use
Browser.Document.body.thiscontrol (I think it's that or it's Document.thiscontrol...)

you should be able to change the properties the same way you would do it with Vbscript. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Nick:
Here some of my code. Thanks.

Private Function Button1_onclick() As Boolean
Dim TotalControls As Long
Dim Counter As Long
Dim str As String

Call LoadMask(Text1.text)
Counter=LBound(maControls)
TotalControls= UBound(maControls)

str = &quot;<TABLE Border=0><TR>&quot;
While Counter <= TotalControls
str = str & &quot;<TD>&quot; & maControls(Counter).ItemLabel & &quot;</TD><TD><input type='text' id=Text&quot; & Counter></TD>&quot;
Counter = Counter + 1
If Counter Mod 2 <> 0 Then str = str & &quot;</TR><TR>&quot;
Wend
str = str & &quot;</TR></TABLE>&quot;
'Here I am creating objects dinamically
Table2.outerHTML = str
Table2.Refresh

End Function

The previous code works well, I can see my new controls in the HTML page, now I want to access these controls I have created:
for example:

document.body.Text1.Value= &quot;12345678&quot; 'or
Text1.Value = &quot;12345678&quot;

It doesn't work with my dynamic controls. VB can not understand these commands so my application can not get or set these values.
 
I didn't realize that when you said you were using a DHTML based solution, that it's actually a VB DHTML application. I've never used that feature in VB. In any case, the DHTML that this forum discusses is not the same as a VB DHTML application. The discussion here revolves mostly around Javascript and CSS.

Maybe Karl or somebody else has some experience with this?
[sig]<p>nick bulka<br><a href=mailto: > </a><br><a href= </a><br>Get your technical books at Bulka's Books<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top