|
1 | | -# How to create grid control in vb net |
| 1 | +# How to Create WPF GridControl in VB.NET? |
2 | 2 |
|
3 | | -This example demonstrates how to create grid control application in vb.net. |
| 3 | +This example demonstrates how to create application with [WPF GridControl](https://www.syncfusion.com/wpf-controls/excel-like-grid) in vb.net. |
| 4 | + |
| 5 | +The GridControl is a cell-oriented control for displaying tabular data. It does not make any assumptions regarding the structure of the data. Users can customize it down to the cell level and can use a grid virtually where the data is provided on demand in real-time. If you are searching for Grid capable of binding different types of data sources and handling data (sorting, filtering, etc.), please refer to the [WPF DataGrid](https://www.syncfusion.com/wpf-controls/datagrid) (SfDataGrid) control. |
4 | 6 |
|
5 | 7 | ### Creating Grid Control in VB.Net |
6 | | -1. Create a new VB.Net WPF application project |
7 | | -2. Install the [Syncfusion.Grid.WPF](https://www.nuget.org/packages/Syncfusion.Grid.WPF) NuGet package as a reference to your .NET Framework applications from NuGet.org. |
| 8 | + |
| 9 | +1. Create a new VB.Net WPF application project. |
| 10 | + |
| 11 | +2. Install the [Syncfusion.Grid.WPF](https://www.nuget.org/packages/Syncfusion.Grid.WPF) NuGet package as a reference to your .NET Framework applications from NuGet.org. |
| 12 | + |
| 13 | + |
| 14 | + |
8 | 15 | 3. Add the following Syncfusion namespace in MainWindow.xaml to make use of the GridControl |
9 | | -4. Add the GridControl inside the `ScrollViewer` control which provides scrollable area to other visible elements that it contains. |
10 | 16 |
|
11 | | -#### XAML |
| 17 | +``` xml |
| 18 | +<Window x:Class="MainWindow" |
| 19 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 20 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 21 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 22 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 23 | + xmlns:local="clr-namespace:GridControlDemo" |
| 24 | + mc:Ignorable="d" |
| 25 | + xmlns:Syncfusion="clr-namespace:Syncfusion.Windows.Controls.Grid;assembly=Syncfusion.Grid.WPF" |
| 26 | + Title="MainWindow" Height="450" Width="800"> |
| 27 | + <Grid> |
| 28 | + </Grid> |
| 29 | +</Window> |
| 30 | +``` |
| 31 | + |
| 32 | +4. Add the GridControl inside the `ScrollViewer` control which provides scrollable area to other visible elements that it contains. |
12 | 33 |
|
13 | 34 | ``` xml |
14 | 35 | <Window x:Class="MainWindow" |
@@ -40,9 +61,10 @@ gridControl.Model.ColumnCount = 10 |
40 | 61 |
|
41 | 62 | ### Populating Data |
42 | 63 |
|
43 | | -Data can be populated in grid control using one of the following methods. |
| 64 | +Data can be populated in GridControl using one of the following methods. |
44 | 65 |
|
45 | 66 | 1. Populate data by looping through the cells in Grid |
| 67 | + |
46 | 68 | ``` vb |
47 | 69 | 'Specifying row and column count |
48 | 70 | gridControl.Model.RowCount = 50 |
@@ -79,4 +101,22 @@ Private Sub grid_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellI |
79 | 101 | e.Style.CellValue = rand.Next(10, 100) |
80 | 102 | End If |
81 | 103 | End Sub |
82 | | -``` |
| 104 | +``` |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +### Editing |
| 109 | + |
| 110 | +GridControl has the default support for editing the cells. Editing can be customized for each cell using various events like `CurentCellStartEditing`, `CurrentCellActivating` and `CurrentCellChanging`, etc. Also, GridControl support various built-in editors such as `DoubleEdit`, `PercentEdit`, `IntegerEdit`, `MaskEdit`, `RichText`, `UpDownEdit`, `CurrencyEdit` and `DateTimeEdit` which can be configured for each cell in GridControl. |
| 111 | + |
| 112 | +### Formulas |
| 113 | + |
| 114 | +GridControl supports Excel-like formulas in each cell and allows to enter algebraic expressions using formulas and cell references by setting the cell type of a cell to `FormulaCell`. The control comes with an extensive formula function library that supports more than 150 built-in formulas. |
| 115 | + |
| 116 | +### Excel-like features |
| 117 | + |
| 118 | +GridControl has the built-in supports to change the appearance like Microsoft Excel current cell, selection and selection frame by using [ExcelLikeCurrentCell](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridModelOptions.html#Syncfusion_Windows_Controls_Grid_GridModelOptions_ExcelLikeCurrentCell), [ExcelLikeSelection](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridModelOptions.html#Syncfusion_Windows_Controls_Grid_GridModelOptions_ExcelLikeSelection) and [ExcelLikeSelectionFrame](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridModelOptions.html#Syncfusion_Windows_Controls_Grid_GridModelOptions_ExcelLikeSelectionFrame) properties respectively. |
| 119 | + |
| 120 | +### Summary |
| 121 | + |
| 122 | +GridControl has the support for various cell types, exporting options, support for serialization, printing support and support to customize the appearance, etc. For more information on the GridControl and its features, please see our [User Guide Documentation](https://help.syncfusion.com/wpf/gridcontrol/overview). You can also refer to the [Feature Tour](https://www.syncfusion.com/wpf-controls/excel-like-grid) site to get an overview on all the features in grid. Refer this [documentation](https://help.syncfusion.com/wpf/control-dependencies#grid-control) to know about the required assemblies for creating GridControl. |
0 commit comments