Page 1
Page 2
Page 3
The SetText method displays the
generated HTML to the browser control. The FitToWindow
property forces the browser display to fit the output to
viewable screen area.

Handling HTML HyperLink Clicks
The WebBrowserCE control exposes several
events. We will explore the HTMLView_HotSpotClick
event. Declaration of the event handler is done with the
following code:
Sub HTMLView_HotSpotClick(HREFText As
String, PostData As String)
Dim sFirstChar as String
Dim sHrefValue as String
sFirstChar = Mid(HREFText, 1, 1)
sHrefValue = Mid(HREFText, 2, Len(HREFText) - 1)
If sFirstChar = "#" Then 'Handle
anchor
'Handle the HREF, pass the value minus the # character
Call HandleClick(sHrefValue)
End If
End Sub
This event evaluates if the first character
of the clicked link is a #. If so, the code
will pass the value of the HREF attribute of the anchor
tag (<a>) to the HandleClick subroutine.
Sub HandleHTMLClick(lParam As String)
'Note the # has been stripped
Dim xmlNodeList As IXMLDOMNodeList
Dim xmlNode As IXMLDOMNode
Dim XPath As String
Dim sReturnXML As String
XPath = "//EmployeeList/Employees[@EmployeeID="""
& lParam & """]"
Set xmlNode = gXMLDoc.selectSingleNode(XPath)
'The selectSingleNode returns a rootless
piece of xml, concat on the root node manually
sReturnXML = "<?xml version=""1.0""?><EmployeeList>"
& xmlNode.XML & "</EmployeeList>"
gXMLDoc.loadXML (sReturnXML)
'define xsl object
Set gXSLDoc = LoadXMLFromFile(App.Path & "\EmployeeDetail.xsl")
'transform into HTML
gsHTML = gXMLDoc.transformNode(gXSLDoc.documentElement)
'Output the HTML
objHtml.SetText(gsHTML)
End Sub

Summary
Well there you have it. Now you can
utilize your XML data from a SQL Server transforming and
displaying HTML directly in eVB. I have heavily commented
the source code for ease of understanding. Get out there
and change the look of you eVB applications with HTML, you
will be pleased with the results.
For Fun - Pocket Word Article version
included
Just for kicks, I have included a Pocket
Word version of the article for offline browsing. Enjoy!
More Resources
More information about XML and
XSL:
http://www.microsoft.com/xml
http://www.w3.org/XML/
http://www.w3.org/Style/XSL/
http://www.w3.org/TR/xpath
More information on WebBrowserCE:
http://www.intelprog.com/webbrowserce.htm
Previous Page