Tag Archives: columns

Rearrange text and format it to initialize variables in C#

This example takes three columns of strings, rearranges them so the values in each column are together, and reformats the results to produce text that you can use to initialize variables. The Shakespeare Insult Kit contains a table holding three … Continue reading

Posted in strings, variables | Tagged , , , , , , , , , , , , , | Leave a comment

Align numeric values in ComboBox and ListBox controls in C#

The example Sort partly numeric items in a ComboBox or ListBox in C# displays a list of values that begin with numbers. Unfortunately the text doesn’t line up nicely in the result. This example solves that problem by using a … Continue reading

Posted in controls, fonts | Tagged , , , , , , , , , , , | Leave a comment

Format DataGridView columns in C#

This example shows how you can format DataGridView columns to make them display values properly. The control is actually pretty smart and will usually do the right thing if you give it the right data. For example, if a column … Continue reading

Posted in controls | Tagged , , , , , , , , , , , | 2 Comments

Set DataGridView column styles in C#

You can set DataGridView column styles by setting a column’s DefaultCellStyle property. It determines the column’s appearance including its foreground color, background color, font, alignment, and colors to use when an item is selected. To set a column’s style at … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , | 1 Comment

Use the TableLayoutPanel control in C#

Much ado is made of WPF’s Grid control, and rightly so because it’s a pretty powerful control. However, many developers forget that Windows Forms has a TableLayoutPanel control that provides many of the same features. Place the control on a … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , | 6 Comments