Add a Web Theme - November 2010
Add 3D - January 2015

If you download this tip please consider making a modest donation.

I have been using class module cTable a lot recently. It allows me to create various controls in an Asp:Table. I recently added theme selection options to the module. Theme support is provided in class module cTheme. This becomes the November 2010 tip-of-the-month. I wrote a VS/2008 Asp.Net, one page, web application project to demonstrate the features.  Click here to run the demo. You may also want to review the January 2015 tip which shows how to create 'Fancy 3d Boxes'. Click here to view that tip.

2013/12/12 Added Gray and Green themes. 2015/01/15 Added a Purple theme and 3D effects.

The Demo Application

Run It -  Click here to run the demo.

Select a color theme from the dropdown box.

Select 3D or not 3D samples.

This sample's color scheme changes after a theme is selected.
Here it was changed from Blue to Green and from 3D to not 3D.

The Blue Theme's 9 colors. The sorted order is used to set the cTable Color Properties.

This is a list of the cTable color properties.
This list changes when a theme is selected. The 'Blue' theme colors are displayed here.
Property gb3D determines whether 3D or non 3D table items are displayed.

Using cTheme

Enum, Sub or Function Description Sample
Public Enum eTheme
End Enum
This Enum defines 11 color themes.  
SetTheme(ByVal iTheme As eTheme, ByVal bSortEm As Boolean) This public subroutine sets up the theme colors. The colors are defined as hex constants. The colors are stored in a collection.  
    iTheme The theme to be setup.  
    bSortEm If True then sort the colors by weight. Black [#000000] being first and white [#FFFFFF] being last. Useful for displaying the colors from darkest to lightest.  
SetupThemeCTable(ByVal iTheme As eTheme) As cTable This public function defines a cTable. Appropriate theme colors are stored in the cTable's color properties. See above. Dim oT as cTable = SetupTheme(eTheme.e020Earth)
    iTheme The theme to be used.  

Using cTable

Properties, Subs and Functions     Description
gb3D True or False. If True 3D effect are created.
bUseThemeColor If True then a theme is being used. If False then the default theme is being used. Set in cTheme method: SetupThemeColors.
iTheme The theme being used. Defined as an Enum.
AddRow Add a Label and Text Box row to the table. See above for 3 rows of labels and text boxes.
Add a row with one, two, three or four buttons. See the sample above for a row with two buttons - Cancel and Save.
Add a cell or row containing a check box. See above for two rows with check boxes.
AddRowDropDown Add a row containing a drop down box. A drop down box is used above to select a theme.
AddRowEmpty Add one or more empty rows.
AddRowError Add a row into which an error or status message can be displayed. The row containing the words 'Theme xxx Selected' is such a row. Functions: MessageClear, MessageGood, MessageError are used. See the source code for details.
AddRowHorizontalLine Add a horizontal line.
Add an image or an image button. The photo above is an image button.
AddRowLabel Add a row containing just text. The instructions and copyright info shown above is created using a row label. See subroutine SetupTableInstructions in Default.aspx for a sample.
AddRowUpperRightMenu Use this to add a row of hyperlinks. The hyperlink information is passed in an array.
AddRowLinkButton Add a row containing a LinkButton. Often used to create a table of contents menu. See the link buttons above.
Add a cell or row containing a RadioButton. Only one button is active at a time. See the radio buttons above.
AddRowSingleColumn Add a row used as a heading. All the 'colored heading' lines above are created using the method. For example the 'FileUploade' row.
AddCellToTable Add a cell to a Table building a new row.
AddRowTable Add a table within a table. Use this to define a table then include it as a row of the parent table.
Use these methods to standardize button, cell, row and table properties.
Use these methods to move data into one of these items. The data could be coming from a database.
Use these methods to move data into a database field. See the cTable source code for details.

Download VB.Net Code

Download the source code by clicking on the zipped file name. Click here to run the demo.

Download - Source Zipped File Size
VS2008 VB Solution 71K

Previous Tip    Tip Index    Next Tip


Updated 2015/01/14