Some steps to export DataGridView to Excel:
1) Download and install the free O2003PIA.exe file
2) In Visual Studio, click on Add Reference (in the Solution Explorer pane)
3) On the COM tab, locate Microsoft Excel 11.0 Object Library and click Select.
4) Click OK in the Add References dialog box to accept your selections. If you are prompted to generate wrappers for the libraries that you selected, click “Yes”.
Continue reading "C# DataGridView to Excel" »
Today I had some troubles finding out how to implement a simple ComboBox in my C# Windows Forms program. Here's my solution because maybe somebody else can use it.
Continue reading "C# ComboBox" »
Defining arrays in C# is rather simple, take a look at these examples:
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i <= 100; i++)
{
int[] array = { i };
foreach (int a in array)
{
Console.WriteLine(a);
}
}
for (int i = 0; i < 100; i++)
{
int[] array = { i };
for (int b = 0; b < array.Length; b++)
{
Console.WriteLine(array[b]);
}
}
Continue reading "Simple arrays in C#" »
I think it's great to show important information in .NET DataTables (and DataSets). DataTables are like database tables, but only existing in memory. It's also possible to show the contents of a DataTable in a dosbox (aka "Windows command line" or "console"). This is a simple example I made with the free Visual Studio C# 2008 Express:
Continue reading "C# example: show contents of a DataTable using a command line tool" »
Recent Comments