Documents
NextGrid & NextDBGrid
- Html Column Tutorial
- Upgrade existing projects for loading changes
- NextGrid Vista Style
- Edit events in NextGrid
- NextGrid How To
- Integrating Inplace Editors
- InputLine Tutorial
- NextGrid Slide Style Tutorial
- Using Editors in runtime
- FieldChooser Tutorial
- Grid Report Tutorial
NextGrid
- TreeColumn Tutorial
- NextGrid Quick Start
- Custom Draw in NextGrid
- Export to XML from NextGrid
- Optimize NextGrid
- NextGrid Custom Sorting
- VirtualColumn Tutorial
- Graphic Column Tutorial
NextDBGrid
- NextDBGrid Quick Start
- NextDBGrid Events
- NextDBGrid How To
- Sorting records in NextDBGrid
- LookupColumn Tutorial
NextInspector
- ToolbarItem tutorial
- NextInspector Advanced tutorial
- NextDBInspector Tutorial
- NextInspector Item Types
- Map VCL property to item
- NextInspector Quick Start
NextSheet
NextCollection
- NxAlertWindow Tutorial
- NxInfoPanel Tutorial
- Vista Styled Panels
- NxPathControl and NxNotebook tutorial
- NxPathControl Quick Start
- NxFlipPanel and NxHeaderPanel Quick Start
- NxOutlookBar Tutorial
- NxPageControl and NxNotebook Quick Start
- NxButton Tutorial
Misc
- Component Names Change
- NxComboBox styles
- Numeric FormatMask
- NxVirtualDataSet tutorial
- DateTime FormatMask
- NxPreview Quick Start
- Quick update
- 32bit Bitmaps Tutorial
- Enable typing unicode characters in InplaceEditors
- Using NxColorScheme
- NxProgress Tutorial
- NxAutoCompletion Tutorial
Labs
NextGrid .NET
- Working with tree
- Custom Drawing in NextGrid dot NET
- NextGrid Dot Net
- NextGrid Dot Net Events
- NextGrid dot NET Quick Start
NextGrid dot NET Quick Start
Related Articles:
Info
- Skill:
- Version: 1.0.0
- Author: Bojan Nikolic
- Created: 2010-09-15
- Updated: 2011-02-06
This article will learn you how to work with NextGrid .NET (in both Design-time and Run-time) very quickly.
Content:
1. Placing control on form
2. Open Desing-time Columns Editor
3. Adding rows
4. Working with cells
5. Working with rows
6. Using events
1. Placing control on form
Click on NextGrid icon in Toolbox.
Then, click on form to place control on it.
Now, when grid is placed on form columns may be added and configured.
2. Open Design-time Columns Editor
Select nextGrid1 and click on button beside Columns property to open Design-time Columns Editor.
When Columns Editor is open you may click buttons on top to add desired column type into grid:
After columns are added, you may select desired column in Columns Editor and modify properties of it in Properties Window. Here are most common properties of column:
Property | Meaning |
---|---|
Editing | When set to true user will be able to edit cells in this column |
Resizeable | When set to false user will not be able to resize this column |
Width | Specify size of column in pixels |
You will probably most want to set Column's title. To do this click on column, expand Header property and set Text property:
Next step in using NextGrid is adding rows and working with them.
3. Adding rows
Adding rows may be done easily. Next methods may be used for adding rows:
Method | Meaning |
---|---|
AddRow() | Add 1 new row at the end of grid. |
AddRow(numberOfRows) | Add numberOfRows at the end of grid. |
InsertRow(position) | Insert 1 new row at specified position. |
Example:
nextGrid1.AddRow(5); // Add 5 new rows at the end of grid nextGrid1.InsertRow(3); // Add 1 new row at position 3
When new row is added, new cell for every column will be added.
3.1. Deleting rows
Row may be deleted by using DeleteRow(rowIndex) method:
nextGrid1.DeleteRow(4);
3.2. Child rows
If you are want to use grid as tree-grid control, there are numerous methods and properties for that. More about this in this article.
4. Working with cells
Each cell in NextGrid is object with own properties such as properties for cell value or background color. Access to one of properties such as BackColor may be done by using 2-dimensional indexer property:
nextGrid1[3, 5].BackColor = Color.Blue;
Most important property of Cell is Value property. This property is object type and depending of the column type you may write:
nextGrid1[3, 5].Value = "test"; nextGrid1[3, 5].Value = 4;
5. Working with rows
As cells, each row is an object. Access to the row is done by single-dimensional indexer:
nextGrid1[5].Visible = false;
Here are some of row properties:
Property | Meaning |
---|---|
RowHeight | Specify height of row in pixels |
Selected | If true row will be selected |
There is also property Cells for accessing cells. Example:
nextGrid1[1].Cells[2].Value = "value";
6. Using events
NextGrid produce many events such as for editing or selecting.
6.1. SelectionChanged event
One of the most importang event is SelectionChanged. This event occur when user select cell with mouse or keyboard. Integer x and y parameters indicate coordinates of selected cell.
6.2. BeforeEdit event
Second important event is BeforeEdit event. This event occur before grid enters into edit state. This event include (ref) accept parameter which may block editing. Example:
private void nextGrid1_BeforeEdit(object sender, CellEventArgs e, ref bool accept) { if (e.Y == 2) { accept = false; } }