Archive for November, 2008

Database viewer and sql SELECT execution

November 28, 2008 1 comment

I wrote a small Database data viewer in C#. This application allow to see the tables and views structures of our database and see the records. You can also write a sql select statement, execute it, and see the resulting records.

There is a small SQL syntax coloring!


It’s written in C# using ADO.NET.

Categories: Database

Database schema viewer in C#

A written in C# a small tool to view the structure of a database.


You select the type of information you want to see:


The code

You create a database connection:

string connectString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + ofd.FileName;
this.connection = new OleDbConnection(connectString);
catch (Exception ex)
this.connection = null;

You gather all the structures infos:

DataTable dts = connection.GetSchema();
foreach (DataRow row in dts.Rows)

When the user select one of the item, you gather the informations of this type and use a DataGridView to show the informations:

string schemaTableName = (string)this.toolStripComboBoxSchemas.SelectedItem;
DataTable dt = connection.GetSchema(schemaTableName);
this.dataGridView.DataSource = dt;

That’s it.

Categories: Database


You can check my new expander (with a header and content controls) here


While developping WinForm applications, I encouter the need to have a more elaborated panel than the simple Panel provided by the .NET framework. So I create a RichPanel.


Supported features

The RichPanel supports:

  • Panel background color: Transparent, solid and gradient fill
  • Gradient style: Horizontal, Vertical, Forward Diagonal and BackwardDiagonal
  • Shadow : Color and thickness (can specifiy not to draw a shadow)
  • Border : Color and width (can specifiy not to draw a border)
  • Rounded corner: Top, Bottom, Both, None. Also can specify the corner radius
  • Header text : Text, Color, Font, Justification(left, center, right)
  • Header back color: (could be transparent or solid)
  • Header icon: The icon and the justification (left, center, right)
  • Header separation line: Position(None, Bottom, Center), Color, Width

How to use the RichPanel

The RichPanel is a control that derive from Panel, so it’s a Panel, and after it has been compiled, it is added directly to the Toolbox. Use can be used it, simply be dragging it from the Toolbox to a form.

RichPanel screenshots

Here are some example of the supported features:




Features to be added in the future

I plan to add somes features to this control.

  • Add a expander (collapse and expand)
  • Provide support for scrolling>

    Source code

  • Categories: Control, WindowsForm

    Quick File Open addin for VisualStudio

    November 23, 2008 1 comment
    QOpen main form

    QOpen main form

    When developping with VisualStudio, I waist a lot of time, searching the file to open in the solution explorer. To reduce it, I wrote a VisualStudio 2008 addin: QOpen

    By default, the QOpen Addin is mapped to the Ctrl+Shift+N shortcut in VisualStudio.

    When started, QOpen open dialog displaying all the files contained in the currently opened solution.

    The Search for TextBox allow to filter the files displayed in the list.

    You can use a space to match more than one part in the file name. For example, imagine that you want to open the TestMFCDoc.h file. You can write ‘mfc’ in the search for textbox, but more than one files will by listed. Add a space and the word ‘doc’ and the word ‘.h’. So you write: mfc do .h

    Here is the example:

    To open the selected file, just hit Enter. If it’s a form, you can press the Designer button or F6 to open it in Designer View.

    The Clear (Ctrl+N) button clear up the Search for textbox to began a new search.

    The up and down arrows, home, end, PageUp and PageDown keys can be used to navigate quickly in the files results list and choose a specific file.

    You can also double-click on a file to open it!


    Source code

    GoogleChart API Wrapper in C# with WindowForms

    GoogleChart Wrapper example

    GoogleChart Wrapper example

    I wrote a simple wrapper class around the GoogleChart API.

    What is GoogleChart

    GoogleChart is a web service that generate charts images. You call a URL with parameters that describe the values, labels, colors, title, and more. There’s a lot of chart type supported: Line, Pie, Bar, Scatter, …

    The following url generate a Hello World Pie chart:,40&chs=250×100&chl=Hello|World

    You can have more details on the GoogleChart API at:

    WindowsForm integration

    The Wrapper that I wrote is simple to use in a Windows Form application. You simply add a PictureBox and assign the Location using the Wrapper GetURL() method. Here is a simple example that demonstrate the use:

    private void Form1_Load(object sender, EventArgs e)
    this.pictureBox1.ImageLocation = SimpleGrid();

    public static string SimpleGrid()
    GoogleChartWrapper gc = new GoogleChartWrapper(376, 293, GoogleChartWrapper.ChartType.BarVertical, "Comparaison results\nYet a other line");
    gc.TitleColor = Color.Red;
    gc.TitleFontSize = 24;
    gc.AddDataValues(new double[] { 38, 50, 25, 76, 92, 66, 23 });
    gc.LegendPlacementPosition = GoogleChartWrapper.LegendPlacement.Right;
    gc.AddAxesLabels(new string[] { "0", "55", "100" });
    gc.AddAxesLabels(new string[] { "1999", "2000", "2002", "2004", "2005", "2006", "2007" });
    return gc.GetURL();

    Complete Form code example:

    Source code

    Categories: C# Tags: ,