Verified Software Products Company
792 Phillips Road || Arroyo Grande, CA 93420-5019 || Phone: (805) 489-5309
Email: bkandler@verisof.com
SERVICES FREEBIES TIPS and TRICKS ARTICLES LINKS HOME
Our Products

Classes
BMPBMP
CryptoCrypto
CSVStringsCSVStrings
DataLoggerDataLogger
DatesDates
DebugRecorderDebugRecorder
FileNameSetFileNameSet
FileSenderFileSender
RDOConnectMasterRDOConnectMaster
ReportAidsReportAids
ShellerSheller
StringSetStringSet
WEBUtilitiesWEBUtilities

Modules
DAOLibDAOLib
GlobalsGlobals
RegistryRegistry

Programs
BatcherBatcher
HTMLGenHTMLGen
KillTimeKillTime
TimedMessageTimedMessage
WEBUtilities: This class contains a collection of 22 methods to help you dynamically construct WEB page content. It provides a lot of the ease of WEB classes without scalability problems.

With this class you can create Page, Form, Table, Row, Cell, Select, Stroke, Font, Color, TextBox, CheckBox, HiddenBox, and Button elements from your Active-X DLL. So you can create almost any page from within the structured environment of VB's IDE where maintainability is much improved over .ASP pages. If you have any other special needs, you can easily add them.

Generating your page content with WEBUtilities makes for smaller .ASP pages. On IIS servers, smaller .ASP pages mean lower overhead for each page served. That's because there is less to compile everytime a page is served .

Also included are Request for extracting item values from a request string (it works just like Response.Request) and SaveRequest which translates special characters (!#$'()*+,-./<=>&) in a request string back into their ASCII equivalents. Using SaveRequest means you don't have to litter your code with numeric character equivalents.

To see sample use of WEBUtilities and its full interface definition, scroll down.
Download me at once!

This somewhat exhausting sample is a part of an application that provides electronic Timecards on an Intranet network. DisplayBulkApprove creates a complete HTML page showing all timecard data for employees in a list provided in its calling sequence. In this nearly complete example, wp is the WEBUtilities object.
Dim wp as WEBUtilities
  Set wp = New WEBUtilities

Function DisplayBulkApprove(FormName, EmpList, CreatorEmpNo, Errors) _
                            As String 
'Returns bulk Timecard approval page
  Dim s        As String
  Dim RowCells As String                'number of cells in row
  Dim TheList  As String
  RowCells = "18"
  RoadMap = ""
  Call wp.FormStart(FormName, "BulkReview") 'start the form
  Call wp.TableStart("1", "0", "0", "100%", wp.Color("", Color_Manila)) 
  'start table of Timecards
  Call wp.RowStart
  s = "Bulk Timecard Approval Screen. <FONT color=red " + _
      "face=Arial>No Timecard changes may be made from this " + _
      "screen; only approvals and rejections."
  Call wp.Cell("center", 1, RowCells, "", "", wp.Font(2, "Arial", "", _
               wp.Stroke("strong", s)))
  Call wp.RowEnd
  Call DisplayBulkApprove_Buttons(RowCells) 'do pushbuttons
  Call wp.RowStart
  s = "Use the checkboxes at the right for specific line actions. " + _
      "Click on an appropriate button to process everything that " + _
      "is marked. Please click the "All Done ..." button " + _
      "when finished so we can close this session gracefully."
  Call wp.Cell("center", 1, RowCells, "", "", wp.Font(2, "Arial", "", _
               wp.Stroke("strong", s)))
  Call wp.RowEnd
  Call DisplayBulkApprove_Header        'top of the card
  TheList = EmpList
  While TheList <> ""                   
    'build timecard display for each entry in emplist
    Call DisplayBulkApprove_Card(CSV.StringFrom(TheList), Invalids, _
                                 CreatorEmpNo, RowCells)
  Wend
  Call wp.RowStart
  Call wp.Cell("", 1, RowCells, "", "", wp.Font(2, "", "", _
               wp.Stroke("strong", "Reject Reason" + _
               wp.TBox(80, "Reason", "", "Enter your reason for " + _
               "rejecting charges; 80 characters. This reason " + _
               "will be applied to all rejected lines"))))
  Call wp.RowEnd
  Call wp.TableEnd
  Call wp.FormEnd                       'complete the form
  DisplayBulkApprove = wp.WebPage       'send back the completed page
End Function

Private Sub DisplayBulkApprove_Buttons(RowCells) 
'Creates HTML for Bulk Approve buttons
  Dim s As String
  s = wp.Button("Process", "Process Inputs", _
                "Click to process Approvals/Rejections you have " + _
                "marked") + vbCrLf + _
      wp.Button("ApproveAll", "Approve All", _
	        "Click to approve all Timecard entries in this " + _
                "display") + vbCrLf + _
      wp.Button("UnApproveAll", "Unapprove All", _
                "Click to unapprove/retract your approval of this " + _
                "entire list of Timecard entries") + vbCrLf + _
      wp.Button("RejectAll", "Reject All", _
                "Click to reject all Timecard enties in this " + _
                "display. The reason you supply below will be " + _
                "applied to all entries.") + vbCrLf + _
      wp.Button("Return", "Back To Selections", "Click to go back " + _
                "to make a new selection of timecards/employees") + _
                vbCrLf + _
      wp.Button("Done", "All Done for Now", "Click to end this session")
  Call wp.RowStart
  Call wp.Cell("center", 1, RowCells, "", "", s)
  Call wp.RowEnd
End Sub

Private Sub DisplayBulkApprove_Card(EmpNo, Invalids, CreatorEmpNo, _
                                    RowCells) 
'Creates HTML to display one timecard for Bulk Approve display
  Dim Row As Integer
  Call tc.LoadEmployee(Unit, EmpNo, True) 'load employee data
  dbRecs = tc.LoadTimecard            'Get charge records from database
  If dbRecs > 0 Then
    For Row = 1 To dbRecs
      Call tc.GetRow(ChargeRow, Row)    'get a row of data
      Call ChargeRowToCharges(Row)      'store into array of charges
      Call wp.RowStart
      Call DisplayBulkApprove_Row(Row, Invalids, RowCells) 'display row
      Call wp.RowEnd
    Next                                'Row
    Call DisplayBulkApprove_Totals      'do the totals
  End If
End Sub

Private Sub DisplayBulkApprove_Header() 
'Create HTML for Bulk Approve Header
  Const st = "strong"
  Const ct = "center"
  Call wp.RowStart
  Call wp.Cell(ct, 1, 1, "", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Emp No")))
  Call wp.Cell(ct, 1, 1, "20%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Employee Name")))
  Call wp.Cell(ct, 1, 1, "2%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "OK?")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "MJO Pool")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "ProjSact")))
  Call wp.Cell(ct, 1, 1, "6%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Task")))
  Call wp.Cell(ct, 1, 1, "3%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "EOC")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "BillCD Org")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Sat")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Sun")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Mon")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Tue")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Wed")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Thu")))
  Call wp.Cell(ct, 1, 1, "7%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Fri")))
  Call wp.Cell(ct, 1, 1, "8%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Total")))
  Call wp.Cell(ct, 1, 1, "2%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "OT")))
  Call wp.Cell(ct, 1, 1, "2%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "SFT")))
  Call wp.Cell(ct, 1, 1, "2%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "Rej")))
  Call wp.Cell(ct, 1, 1, "2%", "", wp.Font(2, "Arial", "", _
               wp.Stroke(st, "App")))
  Call wp.RowEnd
End Sub

Below is the full interface definition for the WEBUtilities Class.
Public Property Let FontFace(ByVal NewFontFace As String)
Public Sub AppendRequest(st) 'appends st to the saved request string
Public Sub BodyEnd() 'Writes page body end to WEBPage
'EX: </BODY>
Public Sub BodyStart(Color) 
'Writes body start & Color specification, to WEBPage
'EX: <BODY {color}>
Public Function Button(Name, Caption, ToolTip) As String 
'Returns Button defined by Name and Caption
'EX: <INPUT type=submit name=Name value=Caption {title=ToolTip}>
Public Function Bold(Content) 'Returns Content as bold text
'EX: <STRONG>Content</STRONG>
Public Function ITALIC(Content) 'Returns Content as ITALIC text
'EX: <ITALIC>Content</ITALIC>
Public Function LineEnd() 'Returns vbCrLf + current Indent
Public Function CBox(Name, value, Checked, ToolTip) As String 
'Returns CheckBox defined by Name, Value, and Checked
'EX: <INPUT type=checkbox {name=Name} {value=Value} {checked} 
     {title=ToolTip}>
Public Sub Cell(Align, iRowSpan, iColSpan, Width, Color, Content) 
'Adds Cell defined by Align, Span, Color and Content to WEBPage
'EX: <TD {align=Align} {width=Width} {RowSpan=iRowSpan} 
     {ColSpan=iColSpan} {Color}Content</TD>
Public Sub ClearWebPage() 'Clear WEBPage of its contents
Public Function Color(ForeColor, BackColor) As String 
'Returns Color defined by ForeColor and BackColor
' EX: color="ForeColor" bgcolor="BackColor"
Public Function Font(iFontSize, FontFace, FontColor, Content) As String 
'Returns Font defined by Fontsize, FontFace, Color, and Content
'EX: <FONT> {size=iFontSize} {face=FontFace} {color=FontColor}
     Content</FONT>
Public Sub FormEnd() 'Adds Form end code to WEBPage
'EX: </FORM>
Public Sub FormStart(ActionFileName, FormName) 
'Adds Form start code to WEBPage
'EX: <FORM action=ActionFileName method=POST name=FormName>
Public Function HBox(Name, value) As String 
'Returns HiddenBox defined by Name and Value
'EX: <INPUT type=hidden {name=Name} {value=Value}>
Public Function HRef(URL, Content) 
'Returns link to URL with specified content
'EX: <a href="URL">Content</a>
Public Sub Header(Title) 'Writes page header with Title to WEBPage
'EX: <HEAD><TITLE>Title</TITLE></HEAD>
Public Function SelectOption(value, txt, selected)
'EX: <OPTION {selected} value=Value>txt
Public Sub PageEnd() 'Adds Page end code to WEBPage
'EX: </BODY></HTML>
Public Sub PageStart(Title, Color) 
'starts a WEBPage with <HTML>, <TITLE>, and <BODY {Color}>
Public Function Request(VarName) As String 
'Returns Request String information for VarName
Public Function RoadMapRequest(RoadMap, VarName) As String 
'Returns the RoadMap contents for VarName
Public Sub RowEnd() 'Writes Row end code to WEBPage
'EX: </TR>
Public Sub RowStart() 'Writes Row start code to WEBPage
'EX: <TR>
Public Sub SaveRequestString(ReqString) 
'Returns ReqString with encodings of special characters 
'translated back to ASCII
Public Function Selection(Name, iLines, MultipleItems, Content) _
                          As String 
'Returns SELECTion control defined by Name, Size, and Content
'EX: <SELECT name=Name size=iLines {multiple}>Content</SELECT>
Public Function Stroke(Emphasis, Content) As String 
'Returns Stroke defined by Emphasis and Content
'EX: <Emphasis>Content<Emphasis>
Public Sub AlignStart(Align) 'Writes align start code to WEBPage
'EX: < {Align} >
Public Sub AlignEnd(Align) 'Writes align end code to WEBPage
'EX: </ {Align} >
Public Sub DivStart(Align) 'Writes DIVision start code to WEBPage. 
'typical align values are center, middle, left, right
'EX: <DIV {align=Align}>
Public Sub DivEnd(Align) 'Writes DIVision end code to WEBPage
'EX: </DIV>
Public Sub TableEnd() 'Writes Table end code to WEBPage
'EX: </TABLE>"
Public Sub TableStart(Border, Padding, Spacing, Width, Color) 
'Writes Table start code to WEBPage based on Align, Border, Padding, 
'Spacing, Width, and Color
'EX: <TABLE border=Border cellpadding=Padding cellspacing=Spacing 
     width=Width Color>
Public Function TBox(iSize, Name, value, ToolTip) As String 
'Returns TextBox defined by Size, Name, and Value
'EX: <INPUT type=text {size=iSize} {name=Name} {value=Value} 
     {title=ToolTip}>
Public Function WEBOption(txt, value, selected) As String 
'Returns Option control defined by Txt, Value, and SELECTed
'EX: <OPTION {SELECTed} value=Value>txt</OPTION>
Public Property Get WebPage() As String 
'Returns the current contents of WEBPage
Public Sub WPage(s) 'Adds text S to WEBPage
Public Function TextAreaStart(iCols, iRows, Name) As String 
'returns start of TextArea specification
'EX: <TEXTAREA name=Name {cols=iCols} {rows=iRows}>
Public Function TextAreaEnd() As String 
'returns end of TextArea specification
'EX: </TEXTAREA>

This site designed by William D. Kandler (bkandler@verisof.com)
Updated: 6/29/01