4 messages in org.openoffice.fr.progRe: [prog] Tableau dans un procédure
FromSent OnAttachments
xavier roguiezJun 14, 2009 6:21 am 
Thibault VataireJun 15, 2009 5:07 am 
Laurent GodardJun 15, 2009 7:34 am 
Thibault VataireJun 15, 2009 10:03 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] Tableau dans un procédureActions...
From:Thibault Vataire (tvat@starxpert.fr)
Date:Jun 15, 2009 10:03:26 am
List:org.openoffice.fr.prog

Bonjour Laurent,

Je pense que l'utilisation d'un variant ne change rien au fond du problème. Cela permet effectivement de passer le tableau avec le mot clé "byval", mais en
réalité il est toujours passé par référence. Pour s'en convaincre, exécuter
l'exemple suivant :

sub mainArray()

dim tab(1) as double dim index as long

tab(0) = 0 tab(1) = 1

'affichage avant manipulation for index = lbound(tab) to ubound(tab) msgbox(tab(index)) next

manipulerTableau(tab)

'affichage après manipulation for index = lbound(tab) to ubound(tab) msgbox(tab(index)) next

end sub

sub manipulerTableau(byval tab as variant)

tab(1) = 2

end sub

Cordialement,

T. Vataire

----- Mail Original ----- De: "Laurent Godard" <oooc@free.fr> À: pr@fr.openoffice.org Envoyé: Lundi 15 Juin 2009 16h34:28 GMT +02:00 Harare / Pretoria Objet: Re: [prog] Tableau dans un procédure

Bonjour Xavier

pour essayer et si tu passes avec un variant ?

sub manipulerTableau(byval v() as double)

deviendrait

sub manipulerTableau(byval v)

Laurent