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
LVL 3
ivancAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

clockwatcherCommented:
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"

0
ivancAuthor Commented:
Clockwatcher

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

Please help.

Tks

Ivanc
0
ivancAuthor Commented:
Clockwatcher

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

Please help.

Tks

Ivanc
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

clockwatcherCommented:
Sorry,

The DHTML model under VB doesn't allow you to do a document.write, probably because that would actually overwrite the DHTML page you're currently executing.  To get the same thing, you'd use:

document.body.innertext = "Hello World"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ivancAuthor Commented:
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
0
clockwatcherCommented:
Perhaps it would help if you posted your full module.
0
ivancAuthor Commented:
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
0
ivancAuthor Commented:
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
0
ivancAuthor Commented:
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
0
clockwatcherCommented:
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
0
ivancAuthor Commented:
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
0
ivancAuthor Commented:
Clockwatcher

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

TKs

Ivanc
0
clockwatcherCommented:
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'
0
ivancAuthor Commented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.