Sponsored Ad

Saturday, September 26, 2009

C# List Box

ListBox affiliated from System.Windows.Forms.ListBox. Its primary action is to architecture anniversary Item into assorted columns. Secondly, the applicant should be able to retrieve the capacity of any cavalcade in any row easily. I absitively the best way to do this would be to actor the cartoon of the accepted DataGrid.


 

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using AsYetUnnamed;

public class Form1 : System.Windows.Forms.Form
{
    private DataSet ds;
    private MultiColumnListBox listBox1;
    public Form1()
    {
        ds = DataArray.ToDataSet(new object[,]{
                    {"Row0, col0",  "Row0, col1" ,1},
                    {"Row00, col0", "Row1, col1" ,new object()},
                    {"Row1, col0",  "Row2, col1" ,"Some String"},
                    {"Row1a, col0", "Row3, col1" ,Rectangle.Empty},
                    {"row1aa,col0", "Row4, col1" ,1},
                    {"row0, col0",  "Row5, col1" ,1},
                    {"pow0, col0",  "Row6, col1" ,1},
                    {"Row7, col0",  "Row7, col1" ,new ExampleClass()},
                    {"Row8, col0",  "Row8, col1" ,Image.FromFile("StopLight.gif")}
                    });
        listBox1 = new MultiColumnListBox();
        listBox1.Parent = this;

        listBox1.DataSource = arr;           
    }
    class ExampleClass
    {
        Public override string ToString()
        {
            return "Hello from ExampleClass!!";
        }
    }

}

0 comments:

Post a Comment

Sponsored Ad

Website Update

Followers