Spread WPF Documentation
IsColumnBound Method
Example 


The column index.
Gets whether the specified column is bound to a data source.
Syntax
'Declaration
 
Public Function IsColumnBound( _
   ByVal column As System.Integer _
) As System.Boolean
'Usage
 
Dim instance As Worksheet
Dim column As System.Integer
Dim value As System.Boolean
 
value = instance.IsColumnBound(column)
public System.bool IsColumnBound( 
   System.int column
)

Parameters

column
The column index.

Return Value

true if the column is bound; otherwise, false.
Example
This example uses the IsColumnBound method.
System.Data.DataTable dt = new System.Data.DataTable("Test");
System.Data.DataRow dr = default(System.Data.DataRow);
dt.Columns.Add("Series0");
dt.Columns.Add("Series1");
dr = dt.NewRow();
dr[0] = 2;
dr[1] = 1;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 4;
dr[1] = 2;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = 3;
dr[1] = 4;
            
gcSpreadSheet1.Sheets[0].DataSource = dt;
gcSpreadSheet1.Sheets[0].DataAutoHeadings = true;
gcSpreadSheet1.Sheets[0].BindDataColumn(1, "Series0");
gcSpreadSheet1.Sheets[0].Columns[0].DataField = "Series1";
gcSpreadSheet1.Invalidate();

   private void button1_Click(object sender, RoutedEventArgs e)
       {
      Boolean r;
      Boolean c;
      string colinfo;
      object colinfo1;
      r = gcSpreadSheet1.Sheets[0].IsRowBound(0);
      c = gcSpreadSheet1.Sheets[0].IsColumnBound(0);
      colinfo = gcSpreadSheet1.Sheets[0].GetDataColumnName(1);
      colinfo1 = gcSpreadSheet1.Sheets[0].GetColumnDataType(1);
      listBox1.Items.Add(r.ToString());
      listBox1.Items.Add(r.ToString());
      listBox1.Items.Add(colinfo.ToString());
      listBox1.Items.Add(colinfo1.ToString());
      gcSpreadSheet1.Invalidate();
       }
Dim dt As New System.Data.DataTable("Test")
Dim dr As System.Data.DataRow
dt.Columns.Add("Series0")
dt.Columns.Add("Series1")
dr = dt.NewRow()
dr(0) = 2
dr(1) = 1
dt.Rows.Add(dr)

dr = dt.NewRow()
dr(0) = 4
dr(1) = 2
dt.Rows.Add(dr)

dr = dt.NewRow()
dr(0) = 3
dr(1) = 4
dt.Rows.Add(dr)

GcSpreadSheet1.Sheets(0).DataSource = dt
GcSpreadSheet1.Sheets(0).DataAutoHeadings = True
GcSpreadSheet1.Sheets(0).BindDataColumn(1, "Series0")
GcSpreadSheet1.Sheets(0).Columns(0).DataField = "Series1"
GcSpreadSheet1.Invalidate()

    Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        Dim r As Boolean
        Dim c As Boolean
        Dim colinfo As String
        Dim colinfo1 As Object
        r = GcSpreadSheet1.Sheets(0).IsRowBound(0)
        c = GcSpreadSheet1.Sheets(0).IsColumnBound(0)
        colinfo = GcSpreadSheet1.Sheets(0).GetDataColumnName(1)
        colinfo1 = GcSpreadSheet1.Sheets(0).GetColumnDataType(1)
        ListBox1.Items.Add(r.ToString())
        ListBox1.Items.Add(r.ToString())
        ListBox1.Items.Add(colinfo.ToString())
        ListBox1.Items.Add(colinfo1.ToString())
        GcSpreadSheet1.Invalidate()
    End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional (SP4), Windows XP (SP2), Windows 2008, Windows 2003 Server (SP1)

See Also

Reference

Worksheet Class
Worksheet Members

 

 


Copyright © GrapeCity, inc. All rights reserved.