[VB] Les reels

Les reels [VB] - VB/VBA/VBS - Programmation

Marsh Posté le 21-05-2004 à 22:02:46    

Je voudrai tout simplement mettre un reel dans une variable de type single mais je n'y arrive pas! que dois je faire?
 
Dim i As Single
i = 1.2
 
Chez moi ca affiche "1"...

Reply

Marsh Posté le 21-05-2004 à 22:02:46   

Reply

Marsh Posté le 21-05-2004 à 22:03:35    

tu l'affiches comment ton single?


---------------
Whichever format the fan may want to listen is fine with us – vinyl, wax cylinders, shellac, 8-track, iPod, cloud storage, cranial implants – just as long as it’s loud and rockin' (Billy Gibbons, ZZ Top)
Reply

Marsh Posté le 21-05-2004 à 22:05:02    

en fait j'affiche le resultat dans un label et ca m'affiche 1 au lieu de 1.2 mais i est bien egal a 1.2


Message édité par conektion le 21-05-2004 à 22:05:23
Reply

Marsh Posté le 21-05-2004 à 22:08:44    

j'ai créé une form avec un label et j'ai mis le code suivant, et ça m'affiche 1,2 comme je m'y attendais:
 

Code :
  1. Option Explicit
  2. Private Sub Form_Load()
  3.     Dim i As Single
  4.     i = 1.2
  5.     Label1.Caption = i
  6. End Sub


 
[:spamafote]


---------------
Whichever format the fan may want to listen is fine with us – vinyl, wax cylinders, shellac, 8-track, iPod, cloud storage, cranial implants – just as long as it’s loud and rockin' (Billy Gibbons, ZZ Top)
Reply

Marsh Posté le 21-05-2004 à 22:09:45    

regarde un peu les propriétés de ton label (surtout si tu es sous Access), il se peut que le formattage par défaut soit pour afficher de l'entier. Essaie avec 1.7 pour voir si ça t'affiche 2.


---------------
Whichever format the fan may want to listen is fine with us – vinyl, wax cylinders, shellac, 8-track, iPod, cloud storage, cranial implants – just as long as it’s loud and rockin' (Billy Gibbons, ZZ Top)
Reply

Marsh Posté le 21-05-2004 à 22:15:51    

haaa je c pas mais mon pc il devien ouf!! taleur ca marchait pas et maintenant ca affiche bien 1.2 alor ke jai pas changer le code. merci pour ton aide  :pt1cable:

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed