Hi,

I have one task in Visual FoxPro. My task is

1. I have a Form with Grid is Displaying 10 Records.
2. I want to Insert a New Blank Row After 5 Record (Using some Short
Keys..Example Ctrl+N)

Can anyone please guide me in right direction..

Thanks in Advance.

Guruprasath B

Re: How to Insert a Blank Row in a Grid.. by Man-wai

Man-wai
Thu Dec 13 02:59:15 PST 2007

guruprasathb@gmail.com wrote:
> Hi,
>
> I have one task in Visual FoxPro. My task is
>
> 1. I have a Form with Grid is Displaying 10 Records.
> 2. I want to Insert a New Blank Row After 5 Record (Using some Short
> Keys..Example Ctrl+N)

You need to APPEND BLANK in the recordsource of the grid.

select (grid1.recordsource)
append blank

--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.23.9
^ ^ 18:57:01 up 12 days 7:10 2 users load average: 0.06 0.01 0.00
? ? (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa/

Re: How to Insert a Blank Row in a Grid.. by Carsten

Carsten
Thu Dec 13 03:52:46 PST 2007

Guruprasath,

like Chang says, you can insert a record using append blank.
To show the new record at position 5, you need an index as sort-column
(Integer would be good), otherwise the new record would appear at the bottom
of the grid. All sort-colums having the value >= 5 must be incremeted by
one, and the new row becomes the value 5.

Something like this:

UPDATE myCursor SET nSort = nSort +1 WHERE nSort >= 5
INSERT INTO myCursor (nSort) VALUES (5)
THISFORM.Grid1.Refresh

--
Cheers
Carsten
_______________________________

<guruprasathb@gmail.com> schrieb im Newsbeitrag
news:a280e4e1-4d04-4488-84f0-f48faaffe0d3@i29g2000prf.googlegroups.com...
> Hi,
>
> I have one task in Visual FoxPro. My task is
>
> 1. I have a Form with Grid is Displaying 10 Records.
> 2. I want to Insert a New Blank Row After 5 Record (Using some Short
> Keys..Example Ctrl+N)
>
> Can anyone please guide me in right direction..
>
> Thanks in Advance.
>
> Guruprasath B



Re: How to Insert a Blank Row in a Grid.. by guruprasathb

guruprasathb
Thu Dec 13 03:59:37 PST 2007

On Dec 13, 4:52 pm, "Carsten Bonde" <bonde AT real-inkasso DOT de>
wrote:
> Guruprasath,
>
> like Chang says, you can insert a record using append blank.
> To show the new record at position 5, you need an index as sort-column
> (Integer would be good), otherwise the new record would appear at the bottom
> of the grid. All sort-colums having the value >= 5 must be incremeted by
> one, and the new row becomes the value 5.
>
> Something like this:
>
> UPDATE myCursor SET nSort = nSort +1 WHERE nSort >= 5
> INSERT INTO myCursor (nSort) VALUES (5)
> THISFORM.Grid1.Refresh
>
> --
> Cheers
> Carsten
> _______________________________
>
> <guruprasa...@gmail.com> schrieb im Newsbeitragnews:a280e4e1-4d04-4488-84f0-f48faaffe0d3@i29g2000prf.googlegroups.com...
>
>
>
> > Hi,
>
> > I have one task in Visual FoxPro. My task is
>
> > 1. I have a Form with Grid is Displaying 10 Records.
> > 2. I want to Insert a New Blank Row After 5 Record (Using some Short
> > Keys..Example Ctrl+N)
>
> > Can anyone please guide me in right direction..
>
> > Thanks in Advance.
>
> > Guruprasath B- Hide quoted text -
>
> - Show quoted text -

Thanks for your valuable suggestions..

Re: How to Insert a Blank Row in a Grid.. by Dan

Dan
Thu Dec 13 08:52:54 PST 2007

If you want a new record after #5, then go to #6 and issue INSERT BLANK
BEFORE.

However, I should caution you to NEVER use physical record position within a
table. It can cause performance issues if the tables become large. Use
careful index expressions and rely on logical position.

Dan

guruprasathb@gmail.com wrote:
> Hi,
>
> I have one task in Visual FoxPro. My task is
>
> 1. I have a Form with Grid is Displaying 10 Records.
> 2. I want to Insert a New Blank Row After 5 Record (Using some Short
> Keys..Example Ctrl+N)
>
> Can anyone please guide me in right direction..
>
> Thanks in Advance.
>
> Guruprasath B



Re: How to Insert a Blank Row in a Grid.. by Anders

Anders
Thu Dec 13 09:08:33 PST 2007

x = Thisform.Grid1.recordsource
nRow=5
SELECT * FROM (x) INTO ARRAY aTemp
DIMENSION aTemp (ALEN(aTemp,1)+1, ALEN(aTemp,2))
AINS(aTemp, nRow)
ZAP IN (x)
INSERT INTO (x) FROM ARRAY aTemp

-Anders


<guruprasathb@gmail.com> wrote in message
news:a280e4e1-4d04-4488-84f0-f48faaffe0d3@i29g2000prf.googlegroups.com...
> Hi,
>
> I have one task in Visual FoxPro. My task is
>
> 1. I have a Form with Grid is Displaying 10 Records.
> 2. I want to Insert a New Blank Row After 5 Record (Using some Short
> Keys..Example Ctrl+N)
>
> Can anyone please guide me in right direction..
>
> Thanks in Advance.
>
> Guruprasath B