----- Original Message -----
From: "Neeraj Shinde" <
neeraj...@gmail.com>
To: <
neeraj...@gmail.com>
Sent: Tuesday, October 26, 2004 3:12 PM
Subject: A quick way to empty the MSFlexGrid control
> The MSFlexGrid control provides a great way to display records in
> multiple rows and columns. Often, however, you may want to display a
> variable number of rows or colums based on selections from the user.
> As a result you'll need a way to quickly clear not just the contents
> of the extraneous rows, but also to reduce the number of rows in the
> control. For instance, if the MSFlexGrid currently displayed 15 rows,
> and the user chooses to display only 10 at runtime, you need to delete
> five extra rows.
>
> To do so, you might think to loop backwards through the rows and execute
> the RemoveItem method on each row. However, if you have a large number
> of rows to delete, using a For/Next loop could take some serious time
> and hang your application.
>
> As an alternative, you can simply reduce the number of rows by resetting
> the control's Rows property. Normally, this property returns the total
> number of rows in the grid. However, you can also use it to remove rows.
> For instance, if your flexgrid currently contained 15 rows, and you
> wanted to reduce them to 10, you could simply issue the following code
> statement:
>
> MSFlexGrid1.Rows = 9
>
> Don't forget that flexgrid rows start with 0. The above example assumes
> that you haven't placed a header in the very first row. If so, then you
> could set the Rows property to 10 instead of 9 to display ten data rows.
> You can use the flexgrid's Cols property to delete columns in a similar
> manner.
>
>
> --
> Regards,
> Neeraj Shinde
> Email :
neeraj...@rediffmail.com
> URL :
http://www.neerajshinde.cjb.net