Spread for ASP.NET 13 Product Documentation
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / MultiColumnComboBoxCellType Class / ColumnWidths Property
Example


In This Topic
    ColumnWidths Property (MultiColumnComboBoxCellType)
    In This Topic
    Gets or sets the widths (in pixels) of the columns.
    Syntax
    'Declaration
     
    Public Property ColumnWidths As Integer()
    'Usage
     
    Dim instance As MultiColumnComboBoxCellType
    Dim value() As Integer
     
    instance.ColumnWidths = value
     
    value = instance.ColumnWidths
    public int[] ColumnWidths {get; set;}

    Property Value

    Integer number of pixels in the width of the columns
    Example
    This example sets up the multi column combobox.
    string conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\nwind.mdb";
    string sqlStr = "SELECT * FROM Employees";
    System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(conStr);
    Data.DataSet ds = new Data.DataSet();
    System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sqlStr, conn);
    da.Fill(ds);
    FarPoint.Web.Spread.MultiColumnComboBoxCellType mcb = new FarPoint.Web.Spread.MultiColumnComboBoxCellType();
    mcb.ColumnEdit = 2;
    mcb.ColumnEditName = "Last Name";
    mcb.ColumnWidths = new int[] {
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80,
            80};
    mcb.DataColumn = 1;
    mcb.DataColumnName = "First Name";
    mcb.ListAlignment = FarPoint.Web.Spread.Editor.ListAlignment.Right;
    mcb.ListHeight = 390;
    mcb.ListOffset = -30;
    mcb.ListWidth = 520;
    mcb.ShowButton = true;
    mcb.DataSource = ds;
    FpSpread1.Sheets[0].Cells[0, 0].CellType = mcb;
    Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\nwind.mdb"
    Dim sqlStr As String = "SELECT * FROM Employees"
    Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(conStr)
    Dim ds As Data.DataSet = New Data.DataSet()
    Dim da As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlStr, conn)
    da.Fill(ds)
    
    Dim mcb As New FarPoint.Web.Spread.MultiColumnComboBoxCellType
    mcb.ColumnEdit = 2
    mcb.ColumnEditName = "Last Name"
    mcb.ColumnWidths = New Integer() {80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80}
    mcb.DataColumn = 1
    mcb.DataColumnName = "First Name"
    mcb.ListAlignment = FarPoint.Web.Spread.Editor.ListAlignment.Right
    mcb.ListHeight = 390
    mcb.ListOffset = -30
    mcb.ListWidth = 520
    mcb.ShowButton = True
    mcb.DataSource = ds
    FpSpread1.Sheets(0).Cells(0, 0).CellType = mcb
    See Also