PRB: Grid Custom Control: Surprising Results when FillStyle=1Last reviewed: June 21, 1995Article ID: Q80849 |
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Professional Toolkit for Microsoft Visual Basic Programming System for Windows, version 1.0
SYMPTOMSWhen the Grid custom control has its FillStyle property set to 1 (repeat), assignments to the Text and Picture properties store a value in all the cells within the selected region (determined by SelStartCol, SelStartRow, SelEndCol, and SelEndRow). However, the value returned from Text and Picture comes from the current cell (determined by the Col and Row properties). This behavior can produce surprising results when the current cell is located outside the selected region. When FillStyle is 0 (single), the Text and Picture properties store to the current cell and retrieve from the current cell.
RESOLUTIONTo cause the Text property to return the same value assigned when FillStyle=1, set the current cell location to a cell inside the selected region. For example, use this code:
Grid1.Text = "hello" Grid1.Col = Grid1.SelColStart Grid1.Row = Grid1.SelRowStart ' Length of Text is 5 MsgBox "Len(Text)=" + Format$(Len(Grid1.Text)) STATUSThis behavior is by design.
MORE INFORMATIONThe CellSelected property returns True (-1) if the current cell is within the grid's selected region; otherwise, CellSelected returns False (0).
Steps to Reproduce Problem
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |