IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++/CLI Discussion :

Comment Trouver un tableau comme avec Control->Find


Sujet :

C++/CLI

  1. #1
    Membre régulier
    Inscrit en
    Juillet 2007
    Messages
    124
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 124
    Points : 71
    Points
    71
    Par défaut Comment Trouver un tableau comme avec Control->Find
    Bonjours,


    Je cherche à trouver un tableau comme avec Control->Find est-ce possible.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    array<Control ^> ^labelATrouverHeure = Controls->Find(String::Format("label{0}",i), true);
    Merci d'avance.

    TrollTop

  2. #2
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Ton tableau est-il un contrôle?
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  3. #3
    Membre régulier
    Inscrit en
    Juillet 2007
    Messages
    124
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 124
    Points : 71
    Points
    71
    Par défaut
    non c'est des tableaux déclarer

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    private:static array<String ^,2> ^TableauContainer1 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauContainer2 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauContainer3 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauContainer4 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauContainer5 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauContainer6 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauContainer7 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte1 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte2 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte3 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte4 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte5 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte6 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte7 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte8 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte9 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte10 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte11 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte12 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte13 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte14 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte15 = gcnew array<String ^,2> (4,1000);
    private:static array<String ^,2> ^TableauPorte16 = gcnew array<String ^,2> (4,1000);
    On peut faire des tableaux comme un Control ex TextBox ou Label

    Merci pour ton aide

    TrollTop

  4. #4
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Si ces tableaux ne sont pas dans la liste Controls, tu ne peux pas les avoir avec Controls.Find.

    Par contre, tu peux toujours te faire un dictionnaire de tableaux de strings à deux dimensions...

    PS: Pourquoi sont-ils déclarés static?
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  5. #5
    Membre régulier
    Inscrit en
    Juillet 2007
    Messages
    124
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 124
    Points : 71
    Points
    71
    Par défaut
    Comment tu fais pour les mettre dans la liste de control ou bien faire un dictionnaire ?

    Merci

    TrollTop

  6. #6
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Dictionary< String^, array<String^, 2>^ >^ dico = gcnew Dictionary< String^, array<String^, 2>^ >();
    dico->Add(L"TableauContainer1", gcnew array<String^, 2> (4,1000));
    dico->Add(L"TableauContainer2", gcnew array<String^, 2> (4,1000));
    ...
    Et tu peux même t'en faire une boucle for:
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Dictionary< String^, array<String^, 2>^ >^ dico = gcnew Dictionary< String^, array<String^, 2>^ >();
    for(int i=1 ; i<=7 ; i++)
    	dico->Add(String::Format(L"TableauContainer{0}", i), gcnew array<String^, 2> (4,1000));
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  7. #7
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Ou encore, tu peux te faire un tableau de tableaux à la place:
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    array< array<String^, 2>^, 1 >^ TableauxContainer = gcnew array< array<String^, 2>^, 1 >(7);
    array< array<String^, 2>^, 1 >^ TableauxPorte     = gcnew array< array<String^, 2>^, 1 >(16);
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  8. #8
    Membre régulier
    Inscrit en
    Juillet 2007
    Messages
    124
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 124
    Points : 71
    Points
    71
    Par défaut
    pour le premier sa fonctionne pas erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Dictionary< String^, array<String^, 2>^ >^ dico = gcnew Dictionary< String^, array<String^, 2>^ >();
    1>d:\visual studio 2008\inventaire\inventaire\Form1.h(1564) : error C2143: erreur de syntaxe*: absence de ';' avant '<'
    1>d:\visual studio 2008\inventaire\inventaire\Form1.h(1564) : error C4430: spécificateur de type manquant - int est pris en compte par défaut. Remarque*: C++ ne prend pas en charge int par défaut
    1>d:\visual studio 2008\inventaire\inventaire\Form1.h(1564) : error C2238: jetons inattendus avant ';'

    pour le deuxième exemple tu déclare la grosseur du tableau où ?
    et comment l'appelle tu dans la procédure ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    array< array<String^, 2>^, 1 >^ TableauContainer = gcnew array< array<String^, 2>^, 1 >(7);
    array< array<String^, 2>^, 1 >^ TableauPorte     = gcnew array< array<String^, 2>^, 1 >(16);
    Merci

    TrollTop

  9. #9
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Pour le dictionary, essaie peut-être en précisant qu'il fait partie du namespace System::Collections::Generic.

    Pour le tableau, regarde la fin des lignes (utilise la scrollbar). Tu y verras la taille des tableaux.

    Et ça s'utilise ainsi:
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    int i = ...
    array<String^, 2>^ tabContI = TableauxContainer[i-1];
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  10. #10
    Membre régulier
    Inscrit en
    Juillet 2007
    Messages
    124
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 124
    Points : 71
    Points
    71
    Par défaut
    pour le tableau tu as juste écrit (7) et (16) tandis que moi c (4,1000)
    le 7 c'est le nombre de tableaucontainer et 16 le nombre de tableauPorte
    mais il y a pas la grosseur comme (4,1000)

    TrollTop

  11. #11
    Expert éminent sénior
    Avatar de Médinoc
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2005
    Messages
    27 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2005
    Messages : 27 369
    Points : 41 519
    Points
    41 519
    Par défaut
    Il faut les instancier séparément:
    Code C++/CLI : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    for(int i=0 ; i<TableauxContainer->Length ; i++)
    	TableauxContainer[i] = gcnew gcnew array<String^, 2> (4,1000);

    Sinon, tu peux aussi carrément te faire un tableau à trois dimensions...
    SVP, pas de questions techniques par MP. Surtout si je ne vous ai jamais parlé avant.

    "Aw, come on, who would be so stupid as to insert a cast to make an error go away without actually fixing the error?"
    Apparently everyone.
    -- Raymond Chen.
    Traduction obligatoire: "Oh, voyons, qui serait assez stupide pour mettre un cast pour faire disparaitre un message d'erreur sans vraiment corriger l'erreur?" - Apparemment, tout le monde. -- Raymond Chen.

  12. #12
    Membre régulier
    Inscrit en
    Juillet 2007
    Messages
    124
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 124
    Points : 71
    Points
    71
    Par défaut
    Caline j'avais pas pensé à ça un tableau 3 dimensions ca fonctionne merci beaucoup pour ton aide si précieuse.

    bye bye @+

    TrollTop

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 3
    Dernier message: 29/04/2007, 17h17
  2. Réponses: 1
    Dernier message: 29/04/2006, 16h55
  3. [Tableaux] Trier un tableau comme avec ORDER BY DESC
    Par Anduriel dans le forum Langage
    Réponses: 28
    Dernier message: 08/12/2005, 18h50
  4. Comment créer des onglets comme avec Excel (sheet1/sheet2)
    Par pierrot10 dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 20/09/2005, 16h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo