Clip Property

See Also1FIKNCZ              Example2MLTDJ9>Low

Applies To

Grid2VGT0PT.

Description

Determines the contents of the cells in a grid's selected region.  Not available at design time.

Usage

[form.]grid.Clip[ = stringexpression ]

Remarks

The stringexpression can contain the contents of multiple rows and columns.  In stringexpression, a tab character (ANSI character 9) indicates a new cell in a row, and a carriage return (ANSI character 13) indicates the beginning of a new row.  Use the ChrLANCHR function to embed these characters in strings.  For example, this line of code puts text into a selected area two rows high and two columns wide:

Grid1.Clip = "1st" & Chr(9) & "a" & Chr(13) & "2nd" & Chr(9) & "b"

When placing data into a grid, only the selected cells are affected. If there are more cells in the selected region than are described in stringexpression, the remaining cells are set to null. If there are more cells described in stringexpression than in the selected region, the unused portion of stringexpression is ignored.

Data Type

String7WSH0XQ


See Also

Help:

SelEndCol, SelStartCol, SelEndRow, SelStartRow Properties1Q7SBUK

Text Property14TWSRU

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"


Clip Property Example

The example puts the current date and time into the selected area of the grid when the user clicks the form.  To try this example, use the Add File command on the File menu to add GRID.VBX to a project, paste the code into the Declarations section of a new form, and then draw a grid.  Press F5 to run the program.

Sub Form_Load ()

   Grid1.Rows = 8                  ' Set rows and columns.

   Grid1.Cols = 5

End Sub

 

Sub Form_Click ()

   Dim Msg As String

   Msg = "Date" & Chr(9)           ' Create a text string.

   Msg = Msg & Format(Now, "Short Date") & Chr(13)

   Msg = Msg & "Time" & Chr(9)

   Msg = Msg & Format(Now, "Short Time")

   Grid1.Clip = Msg                ' Paste string into grid.

End Sub