In this tutorial, you will learn how to use the grid's DataView property to display data in uncommon display formats such as Inverted View, GroupBy View, and Form View.
Complete the following steps:
Normal
Inverted
Form
GroupBy
MultipleLines
Hierarchical
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Normal Me.ComboBox1.SelectedIndex = 0 |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Normal; this.comboBox1.SelectedIndex = 0; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Select Case ComboBox1.SelectedItem Case "Normal" Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Normal Case "Inverted" Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Inverted Case "Form" Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Form Case "GroupBy" Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.GroupBy Case "MultipleLines" Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.MultipleLines Case "Hierarchical" MessageBox.Show ("Hierarchical View can't be set at run time. Please see the Hierarchical Display tutorial") End Select End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void ComboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { switch (ComboBox1.SelectedItem) { case "Normal": this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Normal; break; case "Inverted": this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Inverted; break; case "Form": this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Form; break; case "GroupBy": this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.GroupBy; break; case "MultipleLines": this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.MultipleLines; break; case "Hierarchical"; MessageBox.Show ("Hierarchical View can't be set at run time. Please see the Hierarchical Display tutorial"); break; } } |
You've successfully completed displaying multiple data views; this concludes the tutorial.