GrapeCity.Win.MultiRow Namespace > NewCellPositionNeededEventArgs Class : NewCellPosition Property |
Public Property NewCellPosition As CellPosition
Dim instance As NewCellPositionNeededEventArgs Dim value As CellPosition instance.NewCellPosition = value value = instance.NewCellPosition
public CellPosition NewCellPosition {get; set;}
Exception | Description |
---|---|
System.InvalidOperationException | The Template is a null reference (Nothing in Visual Basic). |
System.ArgumentOutOfRangeException | The assigned CellPosition.SectionIndex is less than 0 or greater than or equal to the section's count. |
System.ArgumentException | The assigned CellPosition.CellIndex or CellPosition.CellName cannot be found in the specified Section.Cells. -or- The specified Cell cannot be selected. |
The initial value of the property is the current target cell.
You can change the current target cell by setting the NewCellPosition property value.
If the NewCellPosition is not in the visual area, the cell is scrolled into the visual area.
void gcMultiRow1_NewCellPositionNeeded(object sender, NewCellPositionNeededEventArgs e) { // When user tries to switch current cell to another row. // Control checks whether 'State' is 'Delay'. If the 'State' is 'Delay' and the // user did not fill out a description, the current cell changes to 'Description' cell // in the same section, and pops up a message box to notify the user to fill out this cell. if (e.SectionIndex != e.NewCellPosition.SectionIndex) { object projectState = gcMultiRow1[e.SectionIndex,"State"].Value; object description = gcMultiRow1[e.SectionIndex, "Description"].Value; if (description == null || object.Equals(string.Empty, description)) { if(object.Equals(projectState, "Delay")) { MessageBox.Show("If project state is delay, fill out a description."); e.NewCellPosition = new CellPosition(e.SectionIndex, "Description"); } } }
Private Sub gcMultiRow1_NewCellPositionNeeded(ByVal sender As Object, ByVal e As NewCellPositionNeededEventArgs) Handles gcMultiRow1.NewCellPositionNeeded ' When the user tries to switch current cell to another row. ' Control checks whether 'State' is 'Delay'. If the 'State' is 'Delay' and the ' user did not fill out a description, the current cell changes to 'Description' cell ' in the same section, and pops up a message box to notify the user to fill out this cell. If e.SectionIndex <> e.NewCellPosition.SectionIndex Then Dim projectState As Object = gcMultiRow1(e.SectionIndex, "State").Value Dim description As Object = gcMultiRow1(e.SectionIndex, "Description").Value If description = Nothing OrElse Object.Equals(String.Empty, description) Then If Object.Equals(projectState, "Delay") Then MessageBox.Show("If project state is delay, fill out a description.") e.NewCellPosition = New CellPosition(e.SectionIndex, "Description") End If End If End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2