Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP5 Updating textbox from grid
Message
 
À
07/01/2000 06:24:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00314121
Message ID:
00314447
Vues:
23
Cetin,

Thanks for the help, as you can see I really don't do this for a living but, I want to learn more and your attempt to educate me is much appreciated.

I believe I understand your points and will try to implement them in my form.

Thanks again,

Jim Harvey
jharvey@netrax.net


>You have hit a grid "behaviour" :) A quick fix is to replace those series of (thinking columns are rarely w/o controlsources) :
>
>store ThisForm.Stgrid1.Column1.Text1.value to ThisForm.Sttxthipno.value
>
>with :
>
>store eval(ThisForm.Stgrid1.Column1.Text1.controlsource) to ThisForm.Sttxthipno.value
>
>Better would be (you or someone else could change gridname, columnname or text1 name) :
>ThisForm.Sttxthipno.value = myTable.myField
>
>Also I noticed calculations and placing results of it in textboxes. In that case "programmaticchange" is a good place to put the code so you don't have to worry about duplicating code in more places. ie:
>
>mamtdue = stntrans.amount - stntrans.amtpaid
>
>If all are in textboxes, something like this in prog.change of textboxes of amount and amtpaid would do the job :
>
>thisform.txtmAmtDue.Value = thisform.txtAmount.value - thisform.txtAmtPaid.value
>
>(We are going away from original question but couldn't resist :)
>if fname <> " "
>mlname = trim(fname) + " " + trim(lname)
>else
>mlname = trim(lname)
>endif
>
>block could just be :
>mlname = alltrim(trim(fname) + " " + lname)
>
>
>You also have :
>select stnbuyer
>seek trim(thisForm.Stgrid1.Column3.Text1.value)
>....
>
>I would suggest :
>
>if seek(trim(thisForm.Stgrid1.Column3.Text1.value), "stnbuyer",cStnTAGNAME)
> ....
>endif
>
>because rarely you could hit side effects of cahnging workareas while in grid (I don't have a clear list what they could be - quick ones that comes to mind are that since you're leaving current rec, rowbuffering might update, record level validation fire etc).
>
>Better yet I would suggest a Select-SQL into array there.
>
>Next, since textboxes do not have controlsources and behave like memvars you don't need thisform.refresh at the end (which in turn might fire unwanted side effects especially in parent-child situation).
>
>Last, if this code is to be called from every click in all columns and is appropriate to have it w/o a click then the form.code could move to grid.AfterRowColchange and free you coding it into all textboxes (or subclassing textboxes just for this).
>
>Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform