home *** CD-ROM | disk | FTP | other *** search
- '===========================================================================
- ' File: MultiGenerator.vb
- '
- ' Summary: This is the one of the derived classes for the CrossLang sample.
- ' This class generates multiplication tables in HTML format.
- '
- '----------------------------------------------------------------------------
- ' This file is part of the Microsoft NGWS Samples.
- '
- ' Copyright (C) 1998-2000 Microsoft Corporation. All rights reserved.
- '============================================================================
-
- Imports System
- Imports TableGen
-
- NameSpace MultiGen
- Public Class MultiGenerator
- Inherits TableGenerator
-
- ' Member variables that represent the width and height of the multiplication
- ' table. These value are extracted from the string passed to SetParameter.
- Dim width As Integer
- Dim height As Integer
-
- '******************************************************************************
- 'Function : SetParameter(byval param as String)
- '
- 'Abstract: This implementation of SetParameter parses the string to find the
- ' width and height of the multiplication table.
- '
- 'Input Parameters: byval param as String = A String representation of what the
- ' client needs.
- '
- 'Returns: none.
- '******************************************************************************
- overrides public sub SetParameter(byval param as String)
-
- ' Take string, parse, get table width and height.
- Dim delimeter As Integer
- delimeter = param.IndexOf("*")
- width = Convert.ToInt32(param.Substring(0, delimeter), 10)
- height = Convert.ToInt32(param.Substring(delimeter + 1, param.Length - (delimeter + 1)), 10)
-
- ' Do simple bounds checking
- If width > 100 Then
- width = 100
- else if width < 1 then
- width = 1
- End If
- If height > 100 Then
- height = 100
- else if height < 1 then
- height = 1
- End If
- End Sub
-
- '******************************************************************************
- 'Function : GetColumnCount() as Integer
- '
- 'Abstract: This implementation of GetColumnCount returns the width of the
- ' multiplication table.
- '
- 'Input Parameters: none.
- '
- 'Returns: Integer = the number of columns for this table.
- '******************************************************************************
- overrides public function GetColumnCount() as Integer
- GetColumnCount = width + 1
- End Function
-
- '******************************************************************************
- 'Function : GetRowCount() as Integer
- '
- 'Abstract: This implementation of GetColumnCount returns the height of the
- ' multiplication table.
- '
- 'Input Parameters: none.
- '
- 'Returns: Integer = the number of rows for this table.
- '******************************************************************************
- overrides public function GetRowCount() as Integer
- GetRowCount = height + 1
- End Function
-
- '******************************************************************************
- 'Function : GetHeader() as String
- '
- 'Abstract: This implementation does not use the HTML header. It returns "".
- '
- 'Input Parameters: none.
- '
- 'Returns: String = the HTML header for this table.
- '******************************************************************************
- overrides public function GetHeader() as String
- GetHeader = ""
- End Function
-
- '******************************************************************************
- 'Function : GetFooter() as String
- '
- 'Abstract: This implementation does not use the HTML footer. It returns "".
- '
- 'Input Parameters: none.
- '
- 'Returns: String = the HTML footer for this table.
- '******************************************************************************
- overrides public function GetFooter() as String
- GetFooter = ""
- End Function
-
- '******************************************************************************
- 'Function : GetCell(byval column as Integer, byval row as Integer) as String
- '
- 'Abstract: This implementation of GetCell calculates the value of the cell for
- ' this column and row.
- '
- 'Input Parameters: byval column as Integer, byval row as Integer = the column and row
- ' to retieve cell data.
- '
- 'Returns: String = the HTML data that represents the specified cell in this table.
- '******************************************************************************
- overrides public function GetCell(byval column as Integer, byval row as Integer) as String
- If Column = 0 And row = 0 Then
- GetCell = ""
- Else
- If Column = 0 Or row = 0 Then
- If Column = 0 Then
- GetCell = "<B>" & row & "</B>"
- Else
- GetCell = "<B>" & Column & "</B>"
- End If
- Else
- GetCell = Convert.ToString(Column * row)
- End If
- End If
- End Function
- End Class
-
- End NameSpace