Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Leading zeroes?
Message
 
À
08/09/1997 19:18:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00049078
Message ID:
00049115
Vues:
39
>I'm fairly new to VFP and I'm having a few problems. Could some kind soul explain to me what is going on here?
>
>Problem 1
>I have a field - Folio_Id displayed on a table maintenance form. It's numeric and has a length of 6, no decimal places.
>I want for the user to be able to enter from 1 to 6 digits and have it filled with leading zeros when they leave the field.
>
>If I specify a Format code of 'L' on the field, when I enter the first digit, the field then fills with TRAILING zeros !?!
>It doesn't matter whether I put the format code in the table designer display format or in the textbox format property
>of the form (or both!) - I cant get any leading zeros noway, nohow!
>
>If I remove the format codes and enter '1234567', on hitting '7' the field changes to '100000' - ie 7 digits, 6 trailing zeros!
>
>If I enter '123' the field is displayed right-justified as expected. If I now highlight the value and start typing or hit 'delete', I can only enter 3 digits before focus moves off the field !?!
>
>Is there some basic tenet in the use of numeric fields I'm missing here?
>Since this field is a key and not to be used in any kind of arithmetic I suppose I should I be using a Character datatype? But then how would I get leading zeros without jumping through hoops?
>

Using L will cause the behavior you describe until the user presses the enter key. At that point, what has been entered will be padded with leading zeroes. You can force this behavior by setting CONFIRM to ON. Note that the data will be stored in the table without leading zeroes. If this isn't what you want, change the data type to character and use the PADL() function to add the additional characters in the .LostFocus or .Valid events.

>Problem 4
>The thing that is really bugging me - unrelated to the above, is the frequency with which VFP5 is crashing.
>This invariably happens soon after I encounter a runtime error in my testing. I can generally cancel the program and close all files, but the next time I rebuild the app, VFP will likely cause an exception error and crash - Dr. Watson I presume!
>A couple of developers I've spoken to say this hardly ever happens to them. I see it several times a day.
>I've tried reinstalling, maximizing Windows Virtual memory size,etc.
>I'm using VFP 5 Prof. Ed. running on NT Workstation 4. Any ideas why this might be happening?
>

I've experienced some of this with ActiveX controls. If you don't do things right, it will crash VFP. Another cause that has been documented here is incompatibility with certain video cards.

HTH,

George
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform