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++Builder Discussion :

comment je suprime les lignes d'un StringGrid


Sujet :

C++Builder

  1. #1
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut comment je suprime les lignes d'un StringGrid
    Bonjour , comment je suprime une ligne de StringGrid si elle verifie pas la condition.merci d'avance pour votre aide.

  2. #2
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Bonjour,
    tout d'abord, si elle vérifie pas la condition ? Quel condition ??
    Si tu n'est pas plus précis, on ne pourra pas beaucoup t'aider.
    Deuxièmement il y as le code qui permet de supprimer une ligne d'un StringGrid dans la FAQ : ici

    A plus

    pottiez

  3. #3
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    salut tout le monde
    finalement j'ai vu que c'est pas important de supprimé la ligne et de affiché une forme au lieu de la supprission en fait j'ai utilsé ce code

    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
    int e;int f; String chaine1,chaine; String M1,M2;int pos3; int pos4; int  a,b;
    {for(int i=1;i<Form4->StringGrid5->RowCount;i++)
    {
    if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
    {  AnsiString chaine = Form4->StringGrid5->Cells[0][i];
     
    {if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
    {chaine1= Form2->ComboBox2->Text;
    e=StrToInt(chaine1);
    chaine= Form4->StringGrid5->Cells[2][i];
     
    M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
    a=StrToInt(M1);
     
    M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
    b=StrToInt(M2);
     
     
    {if(e >= a&& e<= b)
    {Form7->Visible=true;} else {Form3->Visible=true;}
    }}}}}}
    je veut pour la 1er if si la condition n'est pas verifié, la form6 s'affiche
    et la meme chose pour 2eme if .j'espere que ma question est claire.merci d'avance pour votre aide.

  4. #4
    Expert confirmé
    Avatar de ludojojo
    Homme Profil pro
    Développeur SharePoint
    Inscrit en
    Avril 2008
    Messages
    2 967
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France

    Informations professionnelles :
    Activité : Développeur SharePoint
    Secteur : Conseil

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 967
    Billets dans le blog
    5
    Par défaut
    je veut pour la 1er if si la condition n'est pas verifié, la form6 s'affiche
    et la meme chose pour 2eme if .j'espere que ma question est claire.merci d'avance pour votre aide.
    Je ne comprend ou est ton problème ?? si tu veux simplement afficher une form en fonction de ta condition il suffit de mettre dans ton if :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
    {  AnsiString chaine = Form4->StringGrid5->Cells[0][i];
     TForm6 * form6;
     form6= new TForm6(Form6);
     form6->Visible= true;
    pense à mettre "Unit6.h" dans l'en-tête de ton cpp....

    J'espère que tu pourras avancer
    Aide les autres...
    Et les autres t'aideront....
    Mon site DVP
    N'oubliez pas de consulter les FAQ SharePoint et les cours et tutoriels SharePoint

    N'oubliez pas de voter pour les messages dont la réponse est pertinente

  5. #5
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    Bonjour, en fait mon code est valide que si la condition
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
    est verifié , je veut pour le cas contraire , si aucune ligne de cette colonne n'egale
    la form 6 s'affiche .merci d'avance pour votre aide

  6. #6
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Salut,
    Déjà, une remarque, écrit ton code, clairement si tu veut t'y retrouver, en voyant ton code je n'ai pas envie de m'y plonger dedans pour te dire l'endroit ou mettre le code, alors que je sais quel code mettre pour résoudre ton problème.
    Donc ton code écrit clairement donne :
    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    {
    for(int i=1;i<Form4->StringGrid5->RowCount;i++)
    {
      if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = Form4->StringGrid5->Cells[0][i];
     
    {
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {
          chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= Form4->StringGrid5->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
    {
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
    }
        }
    }
      }
    }
    }
    Déjà on remarque tout de suite que tu as des accolade en trop (mise en rouge ici) ce n'est pas une erreur, mais ça ne sert pas ici.

    Ensuite maintenant je pense que si tu ne sais pas faire les conditions if (puisqu'il s'agit de ta question à la base) tu devrait consulter quelque tuto sur le c ou le c++

    Je te donne tout de même la réponse, il faut mettre un else pour mettre le code lorsque ta condition ne se verifie pas :
    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    for(int i=1;i<Form4->StringGrid5->RowCount;i++)
    {
      if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = Form4->StringGrid5->Cells[0][i];
     
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {
          chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= Form4->StringGrid5->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
        }
      }
      else
      {
        //Affichage de la form6
        Form6->Show();
      }
    }

  7. #7
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    salut ,merci pottier , mais je veut la fiche 6 s'affiche que si tout les lignes de la colonne de StringGrid5 n'égale pas .parce que ton code il regarde si la premiere ligne egale pas la forme 6 s'affiche et la valeur existe dans la suite de StringGrid.merci d'avance pour votre aide.

  8. #8
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Salut,
    dans ce cas, il faut tester avec un booléen, ici afficherForm, par défaut il affichera la form (true), mais si la condition est vrai au moins une foit il ne l'affichera pas (false)
    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    bool afficherForm = true;
    for(int i=1;i<Form4->StringGrid5->RowCount;i++)
    {
      if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = Form4->StringGrid5->Cells[0][i];
    
        afficherForm = false;
    
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {
          chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= Form4->StringGrid5->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
        }
      }
    }
    if(afficherForm)
      Form6->Show();

  9. #9
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    merci beaucoup ça marche bien , j'ai fait la meme chose pour la 2eme condition if .mé je me suis trouvé dans un cas qui s'affiche la form 6 et 8 et je veut quand s'affiche la forme 6 la fiche 8 ne s'affiche pas .j'ai met
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(Form6->Visible ==true) Form8->Close();
    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    mé ça ce voi dans l'inteface quel est parti.merci d'avance pour votre aide.
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    bool afficherForm = true;
    bool afficherForm1 = true;
    for(int i=1;i<Form4->StringGrid5->RowCount;i++)
    {
      if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = Form4->StringGrid5->Cells[0][i];
    
        afficherForm = false;
    
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {afficherForm1 = false;      chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= Form4->StringGrid5->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
        }
      }
    }
    if(afficherForm)
      Form6->Show();
    if(afficherForm1)
      Form8->Show()

  10. #10
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Salut,
    ajoute simplement le else comme j'ai mis en rouge, comme sa il va testé pour affiché la form6, et si il n'affiche pas la 6, il test si il doit afficher la 8
    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    mé ça ce voi dans l'inteface quel est parti.merci d'avance pour votre aide.
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    bool afficherForm = true;
    bool afficherForm1 = true;
    for(int i=1;i<Form4->StringGrid5->RowCount;i++)
    {
      if(Form4->StringGrid5->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = Form4->StringGrid5->Cells[0][i];
    
        afficherForm = false;
    
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {afficherForm1 = false;      chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= Form4->StringGrid5->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
        }
      }
    }
    if(afficherForm)
      Form6->Show();
    else if(afficherForm1)
      Form8->Show()

  11. #11
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    merci beaucoup pottier ça marche bien .je veut maintenant ajouté a ce code les meme testes mé avec un StringGrid6 apres StringGrid7 j'ai essayé que changé mé ça marche pas est ce que j'ajout else? merci d'avance pour votre aide.

  12. #12
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Salut,
    je ne vois pas ce que tu veut faire avec ton StringGrid6 et StringGrid7
    Désolé

  13. #13
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    bonjour ,dans mon projet j'ai 3 StringGrid (5,6,7) et il faut que je fé le meme teste pour les 3 StringGrid. on a fait le code que pour StringGrid 5 et il faut ajouté a ce code le meme travail pour 6 et7 .on tout cas merci beaucoup tu ma beaucoup aidé pour avancé dans mon projet.

  14. #14
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Et tu doit afficher exactement les même fenetre ? les StringGrid se trouvent-elles sur la même fenetre ?
    Si c'est le cas, on peut faire une méthode générique :

    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
     
    int indexStringGrid;
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    bool afficherForm;
    bool afficherForm1;
    TStringGrid * vectStringGrid[3] = {Form4->StringGrid5, Form4->StringGrid6, Form4->StringGrid7};
    for(indexStringGrid=0;indexStringGrid<3;indexStringGrid++)
    {
      afficherForm = true;
      afficherForm1 = true;
     
    for(int i=1;i<vectStringGrid[indexStringGrid]->RowCount;i++)
    {
      if(vectStringGrid[indexStringGrid]->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = vectStringGrid[indexStringGrid]->Cells[0][i];
     
        afficherForm = false;
     
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {afficherForm1 = false;      chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= vectStringGrid[indexStringGrid]->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
        }
      }
    }
    if(afficherForm)
      Form6->Show();
    else if(afficherForm1)
      Form8->Show()
    }

  15. #15
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    salut , j'ai encore un probleme .quand par exemple je teste si
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(vectStringGrid[indexStringGrid]->Cells[1][i]==Form2->ComboBox5->Text)
    dans le cas ou elle est verifié dans le StringGrid5 elle s'affiche forme7 et non verifié dans StringGid6 s'affiche la forme 6.alors j'aurai 2 forme qui s'affiche en meme temp. si j' utilise un autre ComboBox3 et je teste si
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(Form2->ComboBox3->Text==Form4->Label1->Caption)
    je fé le travail pour le StringGrid5 .
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(Form2->ComboBox3->Text==Form4->Label2->Caption)
    je fé le travail pour StringGrid6.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(Form2->ComboBox3->Text==Form4->Labe3->Caption)
    je fé le travail pour StringGrid7.
    ou on utilise un autre booléen dans le code?
    merci d'avance pour votre aide.

  16. #16
    Expert confirmé

    Avatar de pottiez
    Homme Profil pro
    Développeur C++
    Inscrit en
    Novembre 2005
    Messages
    7 152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Novembre 2005
    Messages : 7 152
    Par défaut
    Si tu veut qu'il y ai qu'une seul form d'affiché pour les trois StringGrid alors il faut modifier légèrement

    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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    int indexStringGrid;
    int e;
    int f; 
    String chaine1,chaine; 
    String M1,M2;
    int pos3; 
    int pos4; 
    int a,b;
    bool afficherForm = true;
    bool afficherForm1 = true;
    TStringGrid * vectStringGrid[3] = {Form4->StringGrid5, Form4->StringGrid6, Form4->StringGrid7};
    for(indexStringGrid=0;indexStringGrid<3;indexStringGrid++)
    {
    for(int i=1;i<vectStringGrid[indexStringGrid]->RowCount;i++)
    {
      if(vectStringGrid[indexStringGrid]->Cells[1][i]==Form2->ComboBox5->Text)
      {  
        AnsiString chaine = vectStringGrid[indexStringGrid]->Cells[0][i];
     
        afficherForm = false;
     
        if(int pos1 = chaine.Pos(Form2->ComboBox4->Text))
        {afficherForm1 = false;      chaine1= Form2->ComboBox2->Text;
          e=StrToInt(chaine1);
          chaine= vectStringGrid[indexStringGrid]->Cells[2][i];
     
          M1=chaine.SubString(chaine.Pos("[")+1,(chaine.Pos(",")-chaine.Pos("["))-1);
          a=StrToInt(M1);
     
          M2= chaine.SubString(chaine.Pos(",")+1,(chaine.Pos("]")-chaine.Pos(","))-1);
          b=StrToInt(M2);
     
     
          if(e >= a&& e<= b)
          {
            Form7->Visible=true;
          } 
          else 
          {
            Form3->Visible=true;
          }
        }
      }
    }
    }
    if(afficherForm)
      Form6->Show();
    else if(afficherForm1)
      Form8->Show()

  17. #17
    Membre Expert

    Profil pro
    Inscrit en
    Juin 2002
    Messages
    1 407
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2002
    Messages : 1 407
    Par défaut
    Salut !

    Sans doute le faire avec une méthode prenant les objets cibles comme paramètres (a condition que le traitement soit identique d'une cible à l'autre).
    Ca permettrait de simplifier l'écriture et aussi la lecture du code !!!

    A plus !

  18. #18
    Membre éclairé
    Inscrit en
    Avril 2008
    Messages
    335
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 335
    Par défaut
    merci beaucoup pottier ,j'ai bien avancé dans mon projet et tu ma donné une bonne idée.

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

Discussions similaires

  1. Réponses: 5
    Dernier message: 18/03/2009, 12h11
  2. Comment sélectionner que les lignes doublons
    Par Inconnu_du_69 dans le forum Langage SQL
    Réponses: 20
    Dernier message: 12/02/2009, 16h18
  3. suprimer les lignes vides d'un tableau
    Par bosk1000 dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 29/01/2009, 17h03
  4. Réponses: 5
    Dernier message: 24/06/2008, 13h07
  5. Réponses: 1
    Dernier message: 04/08/2007, 18h07

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