GrapeCity.Xaml.SpreadSheet.Data
GetColumnDataType Method (Worksheet)
Example 


GrapeCity.Xaml.SpreadSheet.Data Namespace > Worksheet Class : GetColumnDataType Method
The column index for which the type is requested.
Gets the column data type at the specified position.
Syntax
'Declaration
 
Public Function GetColumnDataType( _
   ByVal column As Integer _
) As Type
'Usage
 
Dim instance As Worksheet
Dim column As Integer
Dim value As Type
 
value = instance.GetColumnDataType(column)
public Type GetColumnDataType( 
   int column
)

Parameters

column
The column index for which the type is requested.

Return Value

Returns the column type for data binding.
Exceptions
ExceptionDescription
Specified index is out of range; must be between 0 and the total number of columns.
Example
This example uses the GetColumnDataType method.
class item
        {
            public int Series1 { get; set; }
            public int Series2 { get; set; }
            public item(int series1, int series2) { Series1 = series1; Series2 = series2; }
        }
        item[] table = new item[3] { new item(2, 1), new item(4, 2), new item(3, 4) };

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.Sheets[0].DataSource = table;
            gcSpreadSheet1.Sheets[0].DataAutoHeadings = true;
            gcSpreadSheet1.Sheets[0].BindDataColumn(1, "Series0");
            gcSpreadSheet1.Sheets[0].Columns[0].DataField = "Series1";       
        }

private void Button_Click_2(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());
            
        }
Class item
        Public Property Series1() As Integer
            Get
                Return m_Series1
            End Get
            Set(value As Integer)
                m_Series1 = Value
            End Set
        End Property
        Private m_Series1 As Integer
        Public Property Series2() As Integer
            Get
                Return m_Series2
            End Get
            Set(value As Integer)
                m_Series2 = Value
            End Set
        End Property
        Private m_Series2 As Integer
        Public Sub New(series1__1 As Integer, series2__2 As Integer)
            Series1 = series1__1
            Series2 = series2__2
        End Sub
    End Class
    Private table As item() = New item(2) {New item(2, 1), New item(4, 2), New item(3, 4)}

   gcSpreadSheet1.Sheets(0).DataSource = table
   gcSpreadSheet1.Sheets(0).DataAutoHeadings = True
   gcSpreadSheet1.Sheets(0).BindDataColumn(1, "Series0")
   gcSpreadSheet1.Sheets(0).Columns(0).DataField = "Series1"

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
        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())
    End Sub
See Also

Reference

Worksheet Class
Worksheet Members