[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference abbott::visual_basic

Title:Microsoft Visual Basic
Moderator:TAMARA::DFEDOR::fedor
Created:Thu May 02 1991
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2565
Total number of notes:10453

2484.0. "Adding rows to a MS Grid" by NETRIX::"[email protected]" (patricia) Fri Jan 31 1997 10:12

Hi,

Is there a way of adding a group of rows to a Microsoft Grid with only a VB
statement?
I've tried to use a CR, CR LF, LF, etc, to separate rows, but with no results.

Any ideas?

Thanks
Patricia.
[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
2484.1ODIXIE::GARABOCyberNeuroSurgeonFri Jan 31 1997 22:289
It's been a long time, but all you need to do is increase the number of rows
in the grid object. Something like

	grdd1.rows=grid1.rows+3

The new rows are added at the end of the grid. You will need to set their
height properties, and any other properties that are not standard. If what
you want is to add rows in the middle of a grid, you add the new rows at the
end, and then move the existing rows to make room for the empty rows.
2484.2What about data?NETRIX::"[email protected]"patriciaWed Feb 05 1997 07:5014
Yes, setting grid1=grid1+something creates new rows in the Grid, but what 
I want is to fill the rows with data.

Grid1.AddItem text, puts data on one row. What I want is to fill all the rows
with only a VB statement, not having to repeat AddItem a lot of times (suppose
I want to fill 100 rows).

Can I use some "special" character in "text" (I've tried CR, LF...), so as to 
fill all the rows with data?

Thanks in advance,
Patricia de las Heras

[Posted by WWW Notes gateway]
2484.3Build string and assign to .ClipFUTURS::MARSHALL1Wed Feb 05 1997 08:2428
    
    Patricia,
    
    	what you need to do is to build a string that holds your cell
    	values separated by a TAB (Chr$(9)) between cells on a line
    	and a CR (Chr$(13)) between lines. So a string to paste to
    	2 lines of two cells would be:
    
    	  sTemp = "Cell(1,1)" & Chr$(9) & "Cell(1,2)" & Chr$(13) & _
    	          "Cell(2,1)" & Chr$(9) & "Cell(2,2)"
    
    	You then need to select the range of cells that you are to
    	paste into:
    
    	  grdMyGrid.SelStartRow = ...
    	  grdMyGrid.SelStartCol = ...
    	  grdMyGrid.SelEndRow = ...
    	  grdMyGrid.SelEndCol = ...
    
    	then you can paste all in one go by:
    
    	  grdMyGrid.Clip = sTemp
    
    
    	Hope this helps,
    
    		Steve