CGrid:DeleteSheet


The DeleteSheet method deletes a sheet by its index. All information in the sheet is lost. The target sheet must be in the range 1 through GetNumSheets.

Syntax

bSuccess = G:DeleteSheet( nIndex )

where

    nIndex is the index of the sheet to be deleted. It must be in the range 1 to GetNumSheets.

    bSuccess is the returned success code. On success it is true, otherwise false.

Example

The following script creates a CGrid with 4 shewets, then deleted sheet 3:

G = NewGrid(3,10,4)

-- new grid with 3 cols, 10 rows, 4 sheets

Printf("Num Sheets = %d\n", G:GetNumSheets() )

-- result: Num Sheets = 4

G:DeleteSheet( 6 )

-- Delete sheet 6 (not valid)

Printf("Num Sheets = %d\n", G:GetNumSheets() )

-- result: Num Sheets = 4

G:DeleteSheet( 2 )

-- Delete sheet 2

Printf("Num Sheets = %d\n", G:GetNumSheets() )

-- result: Num Sheets = 3

Related Topics

SetNumSheets

GetNumSheets

CGrid class