Link to home
Start Free TrialLog in
Avatar of ivanc
ivanc

asked on

VB 6 and DHTML

I am new to this but I am using VB 6 to program a dhtml.  I can't understand why when I call

Response.write ("Hello World")

It generates and error indicating that object required...

Am I missing a library if so which one?

Tks in advance

Ivanc
Avatar of clockwatcher
clockwatcher

Response is an ASP object.  It's not something you'd use in an HTML file.  

Client-side you'd be using:

 document.write "Hello World"

Avatar of ivanc

ASKER

Clockwatcher

When I use document.write it indicates I am using a function or method not supported VB.

Please help.

Tks

Ivanc
Avatar of ivanc

ASKER

Clockwatcher

When I use document.write it indicates I am using a function or method not supported VB.

Please help.

Tks

Ivanc
ASKER CERTIFIED SOLUTION
Avatar of clockwatcher
clockwatcher

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 ivanc

ASKER

ClockWatcher

I have checked up on MS and they have documented the above error as a bug in VB.

I have thus tried the method you have just tested but even more errors resulted

First
set ewioption = document.createelement("Option")

which was working fine gave me an error on Type mismatch

next
Even with the line of code of
Document.body.innertext = "Hello World"

It also resulted in Type mismatch error
Please advice

Ivanc
Perhaps it would help if you posted your full module.
Avatar of ivanc

ASKER

Private Sub DHTMLPage_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim EWIoption As IHTMLOptionElement

cn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\yiscpuewi\darlee\database\ewi.mdb;Persist Security Info=False;Jet
OLEDB:Database Password=ewimj~33"
rs.open "select
Description,FileRef,File,Rev,Originator,Status,Date,Approve,Ack1,Ack2,Approv
eA,Ack1A,Ack2A,Dept, Assy, Affect from EWI Order by Originator", cn
While rs.EOF = False

Document.Body.innerText = rs.Fields("file")
'Set EWIoption = Document.createElement("Option")
EWIoption.Text = rs.Fields("Description")
EWIoption.Value = rs.Fields("Description")
Select1.Options.Add EWIoption
rs.MoveNext

Wend

I am now able to print using the innertext function but I am still get a Type Mismatch error when creating the IHTMLelement

Tks

Ivanc

End Sub
Avatar of ivanc

ASKER

Private Sub DHTMLPage_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim EWIoption As IHTMLOptionElement

cn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\yiscpuewi\darlee\database\ewi.mdb;Persist Security Info=False;Jet
OLEDB:Database Password=ewimj~33"
rs.open "select
Description,FileRef,File,Rev,Originator,Status,Date,Approve,Ack1,Ack2,Approv
eA,Ack1A,Ack2A,Dept, Assy, Affect from EWI Order by Originator", cn
While rs.EOF = False

Document.Body.innerText = rs.Fields("file")
'Set EWIoption = Document.createElement("Option")
EWIoption.Text = rs.Fields("Description")
EWIoption.Value = rs.Fields("Description")
Select1.Options.Add EWIoption
rs.MoveNext

Wend

I am now able to print using the innertext function but I am still get a Type Mismatch error when creating the IHTMLelement

Tks

Ivanc

End Sub
Avatar of ivanc

ASKER

Private Sub DHTMLPage_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim EWIoption As IHTMLOptionElement

cn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\yiscpuewi\darlee\database\ewi.mdb;Persist Security Info=False;Jet
OLEDB:Database Password=ewimj~33"
rs.open "select
Description,FileRef,File,Rev,Originator,Status,Date,Approve,Ack1,Ack2,Approv
eA,Ack1A,Ack2A,Dept, Assy, Affect from EWI Order by Originator", cn
While rs.EOF = False

Document.Body.innerText = rs.Fields("file")
'Set EWIoption = Document.createElement("Option")
EWIoption.Text = rs.Fields("Description")
EWIoption.Value = rs.Fields("Description")
Select1.Options.Add EWIoption
rs.MoveNext

Wend

I am now able to print using the innertext function but I am still get a Type Mismatch error when creating the IHTMLelement

Tks

Ivanc

End Sub
Okay, I think I have a better idea of what you're trying to do now.  Setting the document.body.innerText effectively removes your select element.  Instead of doing that, add a paragraph to your document.  Call it paragraph1 and set its innerText property.

Here's the simplified code.

Private Sub DHTMLPage_Load()

  Dim EWIoption As IHTMLOptionElement
  Set EWIoption = Document.createElement("option")

  paragraph1.innerText = "hello world"

  EWIoption.Text = "mytext"
  EWIoption.Value = "myvalue"
  Select1.Options.Add EWIoption

End Sub
Avatar of ivanc

ASKER

Private Sub DHTMLPage_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim EWIoption As IHTMLOptionElement

cn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\yiscpuewi\darlee\database\ewi.mdb;Persist Security Info=False;Jet
OLEDB:Database Password=ewimj~33"
rs.open "select
Description,FileRef,File,Rev,Originator,Status,Date,Approve,Ack1,Ack2,Approv
eA,Ack1A,Ack2A,Dept, Assy, Affect from EWI Order by Originator", cn
While rs.EOF = False

Document.Body.innerText = rs.Fields("file")
'Set EWIoption = Document.createElement("Option")
EWIoption.Text = rs.Fields("Description")
EWIoption.Value = rs.Fields("Description")
Select1.Options.Add EWIoption
rs.MoveNext

Wend

I am now able to print using the innertext function but I am still get a Type Mismatch error when creating the IHTMLelement

Tks

Ivanc

End Sub
Avatar of ivanc

ASKER

Clockwatcher

I am sorry about the posting but how do I add a paragraph in the code?

TKs

Ivanc
You don't add a paragraph in the code, you add it in the designer-- the same place you added your select element.

Simply click within the document body (next to your select box) and press return.  You'll add a paragraph element.  Expand the document tree, click on the P element you created and give it the id 'paragraph1'
Avatar of ivanc

ASKER

Clockwatcher

I have managed to get it working but I an trying to display the database and thus I am assuming I do not know how many records I have.  Thus I would need to be able to add a new paragraph when a new record is being added.

I was wondering if a table would help the cause

I really appreciate your help thus far.

Ivanc