Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About Grids... 1

Status
Not open for further replies.

fafi

Programmer
Jul 4, 2003
7
0
0
SY
I have two forms, the 1st has a grid (form1) ,the 2nd has a grid and a textbox (form2), the last one is related with the activerow, when I leave 2nd grid all must stored in 1st grid.
I make this code in kepress's form:
[ If nKeyCode = 13
If thisform.grid2.activecolumn=4
Thisform.txtqt_liv.visible=.t.
Thisform.txtqt_liv.top=(thisform.grid2.relativerow*18.5)+16
This.keypreview=.f.
Select tab_vente
Seek article.cod_art
If found()
Thisform.txtqt_liv.value=str(tab_vente.qt_liv)
Endif
This.txtqt_liv.gotfocus
Endif ]
Notes, "This.txtqt_liv.gotfocus" does'nt got the focus in this textbox
1)How can I got it?
I try all controls: Gotfocus, Setfocus, When but without result.
2) The 1st grid dosen’t “append blank”, it store only the last field but in the table exist.
THANKS FOR ANY HELP.
 
Hi fafi,

1)How can I got it?

This.txtqt_liv.setfocus
NODEFAULT

For more info on NODEFAULT, refer the VFP help file or the MSDN.

2) The 1st grid dosen’t “append blank”, it store only the last field but in the table exist.

Refer to the following thread:

Refreshing a grid
thread184-36258 Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Hi Jonscott,
Thank you for your reply.
1)For the textbox is on form2 a cell,I try nodefault also no result.
2)I refresh a grid1 in form1 in code "valid" in the 1st text in this grid, and in keypress but without result.
3)What's diffrent between "allowaddnew" and "append blank"?
 
1)Maybe jonscott has mistyped.
It's suppose 2 b like this:

nodefault
This.txtqt_liv.setfocus()

nodefault comes b4 This.txtqt_liv.setfocus()


3)What's diffrent between "allowaddnew" and "append blank"?
Read allowaddnew's remarks.



 
Hi ALIAS,
THANK YOU FOR YOUR REPLY
Forgot about the focus,may be I haven't explain clearly my problem: So I have two forms, the 1st has a grid (in form1)its recordsource is a free table "tab1" ,the 2nd has a grid and a textbox (in form2)its recordsource is a table "tab2" include in my database but it has an item (qt_liv)has as controlsource tab1 when I wrote any number in this field it will write too in the first record, the last one is related with the activerow, when I leave 2nd grid all must stored in 1st grid.
I wrote this programm in Valid event of grid2 in column of qt_liv:
[Sele tab_vente
Seek article.cod_art
If found()
Repl qt_liv with val(this.value)
Thisform.txtqt_liv.value=""
Else
Append blank
Repl cod_art with article.cod_art
Repl des_art with article.des_art
Repl qt_liv with val(this.value)
Endif]

1) The 1st grid dosen’t “append blank”, it store and point only in the last field but in the table exist all the records.
THANKS FOR ANY HELP.
 
R u telling me that:
1) Form1 has Grid1. Grid1's RecordSource is table1.
2) Form2 has Grid2. Grid2's RecordSource is table2.
FORMSET.FORM2.Grid2.qt_liv.ControlSource is table1 ??
Should'nt it b a field?

>>when I wrote any number in this field it will write too in the first record,
First record of table1 or table2?
>>the last one is
Last One of table1 or table2?
>>related with the activerow
ActiveRow of grid1 or grid2?

Is it that u want the "FORMSET.FORM2.Grid2.qt_liv.Value" to be appended to 'table1' & user can see the "FORMSET.FORM1.Grid1" is updated?

If that's what u want, add this after your code:
Thisform.Grid1.Refresh() or
Thisform.Grid1.RecordSource='table1'
 
HI Alias,
Thanks for your reply.
Isn't a formset, they are 2 depended forms,form1 call form2,
the recordsource of form1 is table1
the recordsource of form2 is table2
the grid1 has the last record of the table1
 
Hi Alias
I add this "Thisform.Grid1.Refresh() or
Thisform.Grid1.RecordSource='table1'"
in my code,but the same result, it display only the last record but I want all records which I add and the scrollbar is enabled (in grid1 in form1)I forced it by Doscroll and Activatecell but no result.
PS Help me
 

Select TableOrCursorAlias
nRec = RECNO()
GO TOP
GO BOTTOM
GO nRec

On large tables this is a bad idea. But works fine on the wee ones.
-Pete
 
GO TOP is enough. Following is the code recommended:

Select TableOrCursorAlias
m.nRec = RECNO()
LOCATE FOR .T. && replacement of GO TOP that
&& works more quickly on filtered data
Grid.Refresh()
GO (m.nRec)
Grid.Refresh() && or Grid.Column.SetFocus()






Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hi ,
thank u for your reply
Perhaps, because the free table is empty that's why i can't see displayed all records in grid1 of form1.
If this right reason, how can i resolve this problem?
thanks for any help
 
Hi,
Thanks for any help.
Some propose me to make a datasession for each form.
1)How can I use it?
2)I look for the eg in "Tastrade" but is full of parameters, I can not understand any things.
Please help me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top