Click here to Skip to main content
15,886,963 members
Articles / Programming Languages / Visual Basic
Article

Enum Code Generator - Generating enum code automatically from database look up tables

Rate me:
Please Sign up or sign in to vote.
4.08/5 (18 votes)
2 Nov 20063 min read 92.8K   1.9K   66   13
Utility to convert data from ID and CODE columns in a look up table into an enum type in C# (or VB.NET).

Sample Image

Introduction

When we write code, we often use enumerations; and enumeration is a set of named integer constants to replace ‘magic numbers’ with meaningful names. When we design relational databases, we use Look Up tables for the same purpose. A look up table is typically modeled with two fields such as ID and Code. Often, the same lookup information is needed in code as well. This results in duplication of this look up data as enumeration types in code. Though the look up information in the database is not as dynamic as other data, it does change from time to time. A prudent developer will update the enums whenever there is a change in the corresponding look up table. This is not a big deal if there are only a few rows, but it becomes cumbersome when there are lots of rows. This EnumGenerator tool eases that pain by auto-generating .NET code (both C# and VB.NET) from a look up table.

Connecting to Data Source

Microsoft packages a COM control called DataLinksClass as part of the ‘MS Data Access Components’ library, to connect to a wide range of data sources. To use this control, you need to add a reference to the COM component ‘Microsoft OLE DB Service Component 1.0 Type Library’. Since this component returns the ADO (not ADO.NET) Connection object on successful connection, you also need to add a reference to ‘Microsoft ActiveX Data Objects 2.8 Library’. The library version does not matter as long as the one you reference includes the ADO Connection object. The following code shows how the connection is established. After successful connection, the connection string from the ADO object is used to create a new ASP.NET connection.

C#
DataLinksClass dl = new DataLinksClass();
_Connection conn = dl.PromptNew() as _Connection;

Reading Database Schema

To generate the enum code, the table name and the column names need to be identified first. ASP.NET’s Connection class provides a method ‘GetOleDbSchemaTable’ for this purpose.

C#
//Get table names
DataTable schemaTable = oleDbConn.GetOleDbSchemaTable(
                        OleDbSchemaGuid.Tables, 
                        new object[] { null, null, null, "TABLE" });

// Display the table name from each row in the schema
foreach (DataRow row in schemaTable.Rows)
{
    tableList.Items.Add(row["TABLE_NAME"]);
}

To get all the columns for a table, set the first parameter of the method GetOleDbSchemaTable as OleDbSchemaGuid.Columns, and pass the table name as the last object in the second parameter’s object collection.

C#
//Get column names
DataTable schemaTable = oleDbConn.GetOleDbSchemaTable(
                        OleDbSchemaGuid.Columns, 
                        new object[] { null, null, tableName });

// Display the table name from each row in the schema
foreach (DataRow row in schemaTable.Rows)
{
    fieldList.Items.Add(row["COLUMN_NAME"]);
}

Reading Data

The DataView in the GUI displays look up data by executing a dynamic SQL on the table for the selected columns. There can be only two columns in the query, out of which one has to be of integer type. Often, this is the primary key. Since the enum is based on two required fields (name and value), there is a validation in the code that checks for the selected fields to be two always. The GetDynamicSql method combines these selected fields to build the SELECT query.

C#
private string GetDynamicSql()
{
    // create dynamic sql
    StringBuilder sb = new StringBuilder();
    sb.Append("Select ");

    int i = 0;
    foreach (string fieldName in fieldList.SelectedItems)
    {
        i++;
        sb.Append("[");
        sb.Append(fieldName);
        sb.Append("]");
        if (fieldList.SelectedItems.Count != i)
            sb.Append(", ");
    }
    sb.Append(" from ");
    sb.Append(tableName);

    return sb.ToString();
}

Code Generation

Initially, I started with just C# code generation. Since there are only a few keyword differences between C# and VB.NET, I decided to add VB.NET code generation also later. The data view displays rows from the lookup table for review. If there is any data, code view displays the corresponding enum code. The following code shows how this is done. To use the generated enums in your code, just cut and paste the text from the code view into your C# or VB.NET project and make the necessary changes.

C#
private void PopulateData(bool isVBDotNet)
{
    try
    {
        if (fieldList.SelectedItems.Count == 2)
        {
            oleDbConn.Open();
            string strSql = GetDynamicSql();
            //Get table names
            OleDbCommand command = new OleDbCommand(strSql, oleDbConn);
            OleDbDataReader dataReader = command.ExecuteReader(
                            CommandBehavior.CloseConnection);

            int nFields = dataReader.FieldCount;

            if (nFields == 2)
            {
                // Setup the columns in the listview
                // using the fields in the table
                dataView.Clear();
                for (int i = 0; i < nFields; i++)
                {
                    dataView.Columns.Add(dataReader.GetName(i), 100, 
                                         HorizontalAlignment.Left);
                }

                StringBuilder sb = new StringBuilder();

                if (isVBDotNet)
                {
                    sb.AppendLine("Public Enum " + tableName);
                }
                else
                {
                    sb.AppendLine("public enum " + tableName);
                    sb.AppendLine("{");
                }

                // Fill the rows in the listview
                // using the data in the rows
                while (dataReader.Read())
                {
                    // Create an array of subitems for quick insertion
                    // The subitems will be all fields in the row except for 
                    // the first field
                    String[] subitems = new String[nFields];
                    int val;
                    if (Int32.TryParse(dataReader[0].ToString(), out val))
                    {
                        subitems[0] = dataReader[1].ToString();
                        subitems[1] = dataReader[0].ToString();
                    }
                    else if (Int32.TryParse(dataReader[1].ToString(), out val))
                    {
                        subitems[0] = dataReader[0].ToString();
                        subitems[1] = dataReader[1].ToString();
                    }
                    else
                    {
                        MessageBox.Show("There are no ID columns " + 
                            "with integer values in the selection");
                        codeView.Text = "";
                        dataReader.Close();
                        return;
                    }

                    string eunumName = subitems[0];
                    if (eunumName.Length == 0)
                        eunumName = "None";

                    sb.Append("\t");
                    eunumName = eunumName.Replace(' ', '_');
                    eunumName = eunumName.Replace('/', '_');
                    eunumName = eunumName.Replace('.', '_');
                    sb.Append(eunumName + " = " + subitems[1]);

                    if (!isVBDotNet)
                    {
                        sb.Append(",");
                    }

                    sb.Append("\n");

                    // Insert a new item into the listview,
                    // and add the subitems at 
                    // the same time. The item will
                    // be the first field in the row
                    ListViewItem item = new ListViewItem(subitems, -1);
                    dataView.Items.Add(item);
                }
                dataReader.Close();

                if (isVBDotNet)
                {
                    sb.AppendLine("End Enum");
                }
                else
                {
                    sb.Remove(sb.Length - 2, 1);
                    sb.AppendLine("}");
                }

                codeView.Text = sb.ToString();
            }
        }
        else
        {
            MessageBox.Show("Please select two(and only" + 
                            " two fields) from the field list");
            dataView.Clear();
            codeView.Text = "";
        }
    }
    finally
    {
        if ((oleDbConn != null) && 
            (oleDbConn.State == ConnectionState.Open))
            oleDbConn.Close();
    }
}

Note

In some cases, the Name or Code column in the look up table may have spaces or other special characters as part of the text data. Since ‘enum’ does not allow spaces or special characters, the code generator replaces those with an underscore.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Global Analyser3-Dec-10 0:09
Global Analyser3-Dec-10 0:09 
GeneralSugg:Create a standalone exe and upload it Pin
rama charan1-Jun-09 4:15
rama charan1-Jun-09 4:15 
NewsSeveral improvements including schema support Pin
Lord of Scripts27-Aug-08 0:00
Lord of Scripts27-Aug-08 0:00 
Following improvements done by me (I am not the author of the original project)
- Support for table schemas, you are no longer bound to the default DBO schema
- Fixed bug with some tables showing ID in the name of the ListView rather than the other column.
- Generated code is now wrapped in a namespace. The namespace ends with the name of the table schema
- User can specify the root namespace that will prefix the schema name in the finale namespace wrapper
- Added tooltips with info
- The ListView is now SORTED and the generated enumeration is also sorted in ascending order

--- CODE FOLLOWS MainForm.cs ---
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MSDASC;
using ADODB;
using System.Data.OleDb;
using System.CodeDom;

namespace EnumCodeGenerator
{
///
/// DEGT added the following:
/// - Support for schemas other than the default (DBO)
/// - Fixed bug with IDs shown in the wrong column of list view
/// - Sort the values of the list view (ascending)
/// - Added Tooltip to controls
/// - Added Root namespace user input
/// - Code is now generated wrapped in a namespace
///

public struct TableInfo
{
public const string DefaultSchema = "dbo";
private string catalog;
private string schemaName;
private string tableName;
public string Schema
{
get { return this.schemaName; }
set { this.schemaName = (String.IsNullOrEmpty(value) ? DefaultSchema : value); }
}
public string TableName
{
get { return this.tableName; }
set { this.tableName = String.IsNullOrEmpty(value) ? String.Empty : value; }
}

public TableInfo(string schema, string tname)
{
this.catalog = String.Empty;
this.schemaName = (String.IsNullOrEmpty(schema) ? DefaultSchema : schema.Trim().ToLower());
this.tableName = tname;
}

public TableInfo(DataRow row) : this((string)row["TABLE_SCHEMA"], (string)row["TABLE_NAME"])
{
this.catalog = (string)row["TABLE_CATALOG"];
}

public TableInfo(string table)
{
this.catalog = String.Empty;
table = table.Trim();
int dot = table.IndexOf(".");
if (dot > 0)
{
string tmp = table.Substring(0, dot);
this.schemaName = String.IsNullOrEmpty(tmp) ? DefaultSchema : tmp;
this.tableName = table.Substring(dot + 1);
}
else
{
this.schemaName = DefaultSchema;
this.tableName = table;
}
}

///
/// The fully qualified table name (minus database name)
///

/// <returns>schema.table i.e. dbo.MyTable
public override string ToString()
{
return String.Format("{0}.{1}", this.schemaName, this.tableName);
}
}

public partial class MainForm : Form
{
OleDbConnection oleDbConn = new OleDbConnection();
TableInfo tableInfo = new TableInfo();

public MainForm()
{
InitializeComponent();
}

private void btnConnect_Click(object sender, EventArgs e)
{
try
{
DataLinksClass dl = new DataLinksClass();
_Connection conn = dl.PromptNew() as _Connection;

if (conn != null)
{
PopulateTables(conn.ConnectionString);
}
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void PopulateTables(string connString)
{
try
{
tableList.Items.Clear();
ResetControls();
if ((connString != null) && (connString.Length > 0))
{
oleDbConn.ConnectionString = connString;
oleDbConn.Open();
//Get table names
DataTable schemaTable = oleDbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });

// Display the table name from each row in the schema
foreach (DataRow row in schemaTable.Rows)
{
// DEGT: added this to make it work with schemas other than DBO
string fullTableName = String.Format("{0}.{1}", row["TABLE_SCHEMA"], row["TABLE_NAME"]);
tableList.Items.Add(fullTableName);
//tableList.Items.Add(row["TABLE_NAME"]);// add TABLE_SCHEMA
}

// Also
}
}
finally
{
if (oleDbConn != null)
oleDbConn.Close();
}

}

private void tableList_SelectedValueChanged(object sender, EventArgs e)
{
this.tableInfo = new TableInfo(tableList.SelectedItem.ToString());
//tableName = tableList.SelectedItem.ToString();

try
{
if (this.tableInfo.TableName.Length > 0)
{
ResetControls();
oleDbConn.Open();
//Get column names (catalog, schema, table)
DataTable schemaTable = oleDbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, this.tableInfo.Schema, this.tableInfo.TableName });

// Display the table name from each row in the schema
foreach (DataRow row in schemaTable.Rows)
{
fieldList.Items.Add(row["COLUMN_NAME"]);
}
}
}
finally
{
if (oleDbConn != null)
oleDbConn.Close();
}
}

private void ResetControls()
{
fieldList.Items.Clear();
dataView.Clear();
codeView.Text = "";
}

private void btnGenCSharpCode_Click(object sender, EventArgs e)
{
this.codeView.Text = String.Empty;
if (PopulateData())
this.codeView.Text = GenerateCode(false);
}

private void btnGenVBDotNetCode_Click(object sender, EventArgs e)
{
this.codeView.Text = String.Empty;
if (PopulateData())
this.codeView.Text = GenerateCode(true);
}

///
/// Generate the code from the sorted values in the ListView. The 1st item
/// in the listview is the ID and the 2nd is the name. Code is now generated
/// with a namespace wrapper. The namespace contains the name of the schema
/// to which the table belongs
///

/// <param name="isVBDotNet" />true for generating VB.NET, otherwise C#
/// <returns>Generated code
private string GenerateCode(bool isVBDotNet)
{
StringBuilder sb = new StringBuilder();

// Wrap the enumeration in a namespace that contains the schema name
// of the table and emit the enumeration declaration
if (isVBDotNet)
{
sb.AppendFormat("Namespace {0}.{1}\n", this.textBoxRootNamespace.Text, this.tableInfo.Schema); // DEGT
sb.AppendLine("Public Enum " + this.tableInfo.TableName);
}
else
{
sb.AppendFormat("namespace {0}.{1}\n", this.textBoxRootNamespace.Text, this.tableInfo.Schema); // DEGT
sb.AppendLine("{"); // DEGT
sb.AppendLine("\tpublic enum " + this.tableInfo.TableName);
sb.AppendLine("\t{");
}

// enumerate all the items
int idColumnIndex = 0; // ListView subitem with ID
int nameColumnIndex = 1; // ListView subitem with Name
foreach (ListViewItem lvi in this.dataView.Items)
{
string enumName = MakeEnumItem(lvi.SubItems[nameColumnIndex].Text);
sb.AppendFormat("\t\t{0} = {1}", enumName, lvi.SubItems[idColumnIndex].Text);
if (!isVBDotNet)
{
sb.Append(",");
}

sb.Append("\n");

}

// Close de enumeration and namespace declarations
if (isVBDotNet)
{
sb.AppendLine("End Enum");
sb.AppendLine("End Namespace"); // DEGT
}
else
{
sb.Remove(sb.Length - 2, 1);
sb.AppendLine("\t}");
sb.AppendLine("}"); // DEGT namespace ends
}

return sb.ToString();
}

///
/// The actual name on the DB may not be a valid identifier in the chosen
/// generation language. We transform it so that the code is correct.
///

/// <param name="fieldNameValue" />raw name
/// <returns>a valid enumeration identifier
private string MakeEnumItem(string fieldNameValue)
{
string enumName;
enumName = fieldNameValue.Replace(' ', '_');
enumName = enumName.Replace('/', '_');
enumName = enumName.Replace('.', '_');
return enumName;
}

private bool PopulateData()
{
bool ok = false;
try
{
if (fieldList.SelectedItems.Count == 2)
{
oleDbConn.Open();
string strSql = GetDynamicSql();
//Get table names
OleDbCommand command = new OleDbCommand(strSql, oleDbConn);
OleDbDataReader dataReader = command.ExecuteReader(CommandBehavior.CloseConnection);

int nFields = dataReader.FieldCount;
int idColumnIndex = -1; // DEGT
int nameColumnIndex = -1; // DEGT
if (nFields == 2)
{
// Setup the columns (2) in the listview using the fields in the table
dataView.Clear();
if (dataReader.GetFieldType(0).ToString().Equals("System.String"))
{
idColumnIndex = 1;
nameColumnIndex = 0;
//dataView.Columns.Add(dataReader.GetName(1), 100, HorizontalAlignment.Left);
//dataView.Columns.Add(dataReader.GetName(0), 100, HorizontalAlignment.Left);
}
else
{
idColumnIndex = 0;
nameColumnIndex = 1;
//dataView.Columns.Add(dataReader.GetName(0), 100, HorizontalAlignment.Left);
//dataView.Columns.Add(dataReader.GetName(1), 100, HorizontalAlignment.Left);
}

dataView.Columns.Add(dataReader.GetName(idColumnIndex), 100, HorizontalAlignment.Left);
dataView.Columns.Add(dataReader.GetName(nameColumnIndex), 100, HorizontalAlignment.Left);
dataView.Sorting = SortOrder.Ascending;

// Fill the rows in the listview using the data in the rows
while (dataReader.Read())
{
// Create an array of subitems for quick insertion
// The subitems will be all fields in the row except for
// the first field
String[] subitems = new String[nFields];
int val;
if (Int32.TryParse(dataReader[0].ToString(), out val))
{
//subitems[0] = dataReader[1].ToString();
//subitems[1] = dataReader[0].ToString();
subitems[nameColumnIndex] = dataReader[1].ToString();
subitems[idColumnIndex] = dataReader[0].ToString();
}
else if (Int32.TryParse(dataReader[1].ToString(), out val))
{
//subitems[0] = dataReader[0].ToString();
//subitems[1] = dataReader[1].ToString();
subitems[nameColumnIndex] = dataReader[1].ToString();
subitems[idColumnIndex] = dataReader[0].ToString();
}
else
{
MessageBox.Show("There are no ID columns with integer values in the selection");
dataReader.Close();
return false;
}

// Insert a new item into the listview, and add the subitems at
// the same time. The item will be the first field in the row
ListViewItem item = new ListViewItem(subitems, -1);
dataView.Items.Add(item);
}
dataReader.Close();

// DEGT with one query alone we can't know which column is the
// ID column to sort in SQL so we simply get the result set and
// let the ListView do the sorting
dataView.Sort(); // DEGT sort it
ok = true;
}
}
else
{
MessageBox.Show("Please select two(and only two fields) from the field list");
dataView.Clear();
ok = false;
}
}
finally
{
if ((oleDbConn != null) && (oleDbConn.State == ConnectionState.Open))
oleDbConn.Close();
}
return ok;
}

private string GetDynamicSql()
{
// create dynamic sql
StringBuilder sb = new StringBuilder();
sb.Append("Select ");

int i = 0;
foreach (string fieldName in fieldList.SelectedItems)
{
i++;
sb.Append("[");
sb.Append(fieldName);
sb.Append("]");
if (fieldList.SelectedItems.Count != i)
sb.Append(", ");
}
sb.Append(" from ");
sb.Append(this.tableInfo.ToString()); // DEGT contains schema and table name

return sb.ToString();
}
}
}

----- CODE FOLLOWS MainForm.designer.cs ----
namespace EnumCodeGenerator
{
partial class MainForm
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///

/// <param name="disposing" />true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnConnect = new System.Windows.Forms.Button();
this.tableList = new System.Windows.Forms.ListBox();
this.fieldList = new System.Windows.Forms.ListBox();
this.btnGenCSharpCode = new System.Windows.Forms.Button();
this.dataView = new System.Windows.Forms.ListView();
this.codeView = new System.Windows.Forms.RichTextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.btnGenVBDotNetCode = new System.Windows.Forms.Button();
this.labelNamespace = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.textBoxRootNamespace = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(17, 15);
this.btnConnect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(147, 28);
this.btnConnect.TabIndex = 0;
this.btnConnect.Text = "&Connect to DB...";
this.toolTip1.SetToolTip(this.btnConnect, "Build a connection string");
this.btnConnect.UseVisualStyleBackColor = true;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
//
// tableList
//
this.tableList.FormattingEnabled = true;
this.tableList.ItemHeight = 16;
this.tableList.Location = new System.Drawing.Point(17, 101);
this.tableList.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.tableList.Name = "tableList";
this.tableList.Size = new System.Drawing.Size(208, 260);
this.tableList.TabIndex = 1;
this.tableList.SelectedValueChanged += new System.EventHandler(this.tableList_SelectedValueChanged);
//
// fieldList
//
this.fieldList.FormattingEnabled = true;
this.fieldList.ItemHeight = 16;
this.fieldList.Location = new System.Drawing.Point(248, 101);
this.fieldList.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.fieldList.Name = "fieldList";
this.fieldList.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.fieldList.Size = new System.Drawing.Size(187, 260);
this.fieldList.TabIndex = 1;
this.toolTip1.SetToolTip(this.fieldList, "Please select TWO fields");
//
// btnGenCSharpCode
//
this.btnGenCSharpCode.Location = new System.Drawing.Point(444, 145);
this.btnGenCSharpCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnGenCSharpCode.Name = "btnGenCSharpCode";
this.btnGenCSharpCode.Size = new System.Drawing.Size(128, 47);
this.btnGenCSharpCode.TabIndex = 0;
this.btnGenCSharpCode.Text = "&Generate C# Code";
this.btnGenCSharpCode.UseVisualStyleBackColor = true;
this.btnGenCSharpCode.Click += new System.EventHandler(this.btnGenCSharpCode_Click);
//
// dataView
//
this.dataView.FullRowSelect = true;
this.dataView.GridLines = true;
this.dataView.Location = new System.Drawing.Point(580, 101);
this.dataView.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.dataView.Name = "dataView";
this.dataView.Size = new System.Drawing.Size(264, 260);
this.dataView.TabIndex = 3;
this.dataView.UseCompatibleStateImageBehavior = false;
this.dataView.View = System.Windows.Forms.View.Details;
//
// codeView
//
this.codeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.codeView.Location = new System.Drawing.Point(853, 101);
this.codeView.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.codeView.Name = "codeView";
this.codeView.Size = new System.Drawing.Size(344, 260);
this.codeView.TabIndex = 4;
this.codeView.Text = "";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 76);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 17);
this.label3.TabIndex = 2;
this.label3.Text = "Tables";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(244, 76);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(45, 17);
this.label4.TabIndex = 2;
this.label4.Text = "Fields";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(576, 76);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(71, 17);
this.label5.TabIndex = 2;
this.label5.Text = "Data View";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(849, 76);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(74, 17);
this.label6.TabIndex = 2;
this.label6.Text = "Code View";
//
// btnGenVBDotNetCode
//
this.btnGenVBDotNetCode.Location = new System.Drawing.Point(444, 230);
this.btnGenVBDotNetCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnGenVBDotNetCode.Name = "btnGenVBDotNetCode";
this.btnGenVBDotNetCode.Size = new System.Drawing.Size(128, 48);
this.btnGenVBDotNetCode.TabIndex = 0;
this.btnGenVBDotNetCode.Text = "&Generate VB.NET Code";
this.btnGenVBDotNetCode.UseVisualStyleBackColor = true;
this.btnGenVBDotNetCode.Click += new System.EventHandler(this.btnGenVBDotNetCode_Click);
//
// labelNamespace
//
this.labelNamespace.AutoSize = true;
this.labelNamespace.Location = new System.Drawing.Point(580, 25);
this.labelNamespace.Name = "labelNamespace";
this.labelNamespace.Size = new System.Drawing.Size(119, 17);
this.labelNamespace.TabIndex = 5;
this.labelNamespace.Text = "Root namespace:";
this.toolTip1.SetToolTip(this.labelNamespace, "Root namespace of generated code");
//
// textBoxRootNamespace
//
this.textBoxRootNamespace.Location = new System.Drawing.Point(706, 20);
this.textBoxRootNamespace.MaxLength = 200;
this.textBoxRootNamespace.Name = "textBoxRootNamespace";
this.textBoxRootNamespace.Size = new System.Drawing.Size(491, 22);
this.textBoxRootNamespace.TabIndex = 6;
this.textBoxRootNamespace.Text = "Application.Data";
this.toolTip1.SetToolTip(this.textBoxRootNamespace, "The schema name will be appended automatically");
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1215, 384);
this.Controls.Add(this.textBoxRootNamespace);
this.Controls.Add(this.labelNamespace);
this.Controls.Add(this.codeView);
this.Controls.Add(this.dataView);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.fieldList);
this.Controls.Add(this.tableList);
this.Controls.Add(this.btnGenVBDotNetCode);
this.Controls.Add(this.btnGenCSharpCode);
this.Controls.Add(this.btnConnect);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "MainForm";
this.Text = "Enum Code Generator";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btnConnect;
private System.Windows.Forms.ListBox tableList;
private System.Windows.Forms.ListBox fieldList;
private System.Windows.Forms.Button btnGenCSharpCode;
private System.Windows.Forms.ListView dataView;
private System.Windows.Forms.RichTextBox codeView;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button btnGenVBDotNetCode;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Label labelNamespace;
private System.Windows.Forms.TextBox textBoxRootNamespace;
}
}

http://www.PanamaSights.com/
http://www.coralys.com/
http://www.virtual-aviation.info/

QuestionConnection error Pin
Lord of Scripts26-Aug-08 5:19
Lord of Scripts26-Aug-08 5:19 
GeneralMaintinability Pin
kirancsai31-Jul-08 17:49
kirancsai31-Jul-08 17:49 
GeneralRe: Maintinability Pin
Lord of Scripts26-Aug-08 23:41
Lord of Scripts26-Aug-08 23:41 
GeneralGreat, but how do I... Pin
benbawden30-Oct-07 0:10
benbawden30-Oct-07 0:10 
GeneralRe: Great, but how do I... Pin
Lord of Scripts26-Aug-08 23:44
Lord of Scripts26-Aug-08 23:44 
GeneralCodedom Pin
mbkasi8-Nov-06 14:27
mbkasi8-Nov-06 14:27 
AnswerRe: Codedom Pin
SLaxman8-Nov-06 15:34
SLaxman8-Nov-06 15:34 
Generalstep in the rigt direction but.... Pin
wurakeem8-Nov-06 7:34
wurakeem8-Nov-06 7:34 
AnswerRe: step in the rigt direction but.... Pin
SLaxman8-Nov-06 16:54
SLaxman8-Nov-06 16:54 
GeneralRe: step in the rigt direction but.... Pin
PeaceTiger19-Jan-10 2:57
PeaceTiger19-Jan-10 2:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.