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# Discussion :

Fontion pour couper du text en C++ dans un TextArea


Sujet :

C#

  1. #1
    Membre habitué
    Homme Profil pro
    Inscrit en
    Septembre 2009
    Messages
    311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2009
    Messages : 311
    Points : 127
    Points
    127
    Par défaut Fontion pour couper du text en C++ dans un TextArea
    Bonjour,

    Je travail avec visual studio 2005 dans un projet Application Windows Forms je doit créer un menu et j'ai un probleme, j aimerai avoir une fonction qui me permet de couper du texte dans un textarea à partir d'un menu "edition"->"couper".
    Lorque j'utilise la methode Cut(); le compilateur m'insulte. Je ne vois vraiement pas comment faire si quelqu'un pouvai m'aider se serai sympas.

    Voici mon 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
    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
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
     
     
    #pragma once
     
     
    namespace ExerciceForm {
     
    	using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
     
     
    		public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    			InitializeComponent();
     
    		}
     
    	protected:
    				~Form1()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
    	private: System::Windows::Forms::Label^  label1;
    	private: System::Windows::Forms::Button^  closeButton;
    	private: System::Windows::Forms::MenuStrip^  menuStrip1;
    	private: System::Windows::Forms::ToolStripMenuItem^  fichierToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  ouvrirToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  fermerToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  editionToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  copierToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  collerToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  couperToolStripMenuItem;
    	private: System::Windows::Forms::TextBox^  textBox1;
     
    	protected: 
     
    	private:
    				System::ComponentModel::Container ^components;
     
    #pragma region Windows Form Designer generated code
    				void InitializeComponent(void)
    		{
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->closeButton = (gcnew System::Windows::Forms::Button());
    			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
    			this->fichierToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->editionToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->copierToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->collerToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->ouvrirToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->fermerToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    			this->couperToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->menuStrip1->SuspendLayout();
    			this->SuspendLayout();
    			// 
    			// label1
    			// 
    			this->label1->AutoSize = true;
    			this->label1->Location = System::Drawing::Point(9, 43);
    			this->label1->Name = L"label1";
    			this->label1->Size = System::Drawing::Size(28, 13);
    			this->label1->TabIndex = 0;
    			this->label1->Text = L"Titre";
    			this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
    			// 
    			// closeButton
    			// 
    			this->closeButton->Location = System::Drawing::Point(12, 184);
    			this->closeButton->Name = L"closeButton";
    			this->closeButton->Size = System::Drawing::Size(82, 23);
    			this->closeButton->TabIndex = 1;
    			this->closeButton->Text = L"Fermer";
    			this->closeButton->UseVisualStyleBackColor = true;
    			this->closeButton->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
    			// 
    			// menuStrip1
    			// 
    			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->fichierToolStripMenuItem, 
    				this->editionToolStripMenuItem});
    			this->menuStrip1->Location = System::Drawing::Point(0, 0);
    			this->menuStrip1->Name = L"menuStrip1";
    			this->menuStrip1->Size = System::Drawing::Size(292, 24);
    			this->menuStrip1->TabIndex = 2;
    			this->menuStrip1->Text = L"menuStrip1";
    			// 
    			// fichierToolStripMenuItem
    			// 
    			this->fichierToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->ouvrirToolStripMenuItem, 
    			this->fermerToolStripMenuItem});
    			this->fichierToolStripMenuItem->Name = L"fichierToolStripMenuItem";
    			this->fichierToolStripMenuItem->Size = System::Drawing::Size(50, 20);
    			this->fichierToolStripMenuItem->Text = L"Fichier";
    			// 
    			// editionToolStripMenuItem
    			// 
    			this->editionToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->copierToolStripMenuItem, 
    				this->collerToolStripMenuItem, this->couperToolStripMenuItem});
    			this->editionToolStripMenuItem->Name = L"editionToolStripMenuItem";
    			this->editionToolStripMenuItem->Size = System::Drawing::Size(51, 20);
    			this->editionToolStripMenuItem->Text = L"Edition";
    			// 
    			// copierToolStripMenuItem
    			// 
    			this->copierToolStripMenuItem->Name = L"copierToolStripMenuItem";
    			this->copierToolStripMenuItem->Size = System::Drawing::Size(152, 22);
    			this->copierToolStripMenuItem->Text = L"Copier";
    			// 
    			// collerToolStripMenuItem
    			// 
    			this->collerToolStripMenuItem->Name = L"collerToolStripMenuItem";
    			this->collerToolStripMenuItem->Size = System::Drawing::Size(152, 22);
    			this->collerToolStripMenuItem->Text = L"Coller";
    			// 
    			// ouvrirToolStripMenuItem
    			// 
    			this->ouvrirToolStripMenuItem->Name = L"ouvrirToolStripMenuItem";
    			this->ouvrirToolStripMenuItem->Size = System::Drawing::Size(152, 22);
    			this->ouvrirToolStripMenuItem->Text = L"Ouvrir";
    			// 
    			// fermerToolStripMenuItem
    			// 
    			this->fermerToolStripMenuItem->Name = L"fermerToolStripMenuItem";
    			this->fermerToolStripMenuItem->Size = System::Drawing::Size(152, 22);
    			this->fermerToolStripMenuItem->Text = L"Fermer";
    			this->fermerToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fermerToolStripMenuItem_Click);
    			// 
    			// textBox1
    			// 
    			this->textBox1->Location = System::Drawing::Point(12, 71);
    			this->textBox1->Multiline = true;
    			this->textBox1->Name = L"textBox1";
    			this->textBox1->Size = System::Drawing::Size(268, 107);
    			this->textBox1->TabIndex = 3;
    			// 
    			// couperToolStripMenuItem
    			// 
    			this->couperToolStripMenuItem->Name = L"couperToolStripMenuItem";
    			this->couperToolStripMenuItem->Size = System::Drawing::Size(152, 22);
    			this->couperToolStripMenuItem->Text = L"Couper";
    			this->couperToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::couperToolStripMenuItem_Click);
    			// 
    			// Form1
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(292, 273);
    			this->Controls->Add(this->textBox1);
    			this->Controls->Add(this->closeButton);
    			this->Controls->Add(this->label1);
    			this->Controls->Add(this->menuStrip1);
    			this->MainMenuStrip = this->menuStrip1;
    			this->Name = L"Form1";
    			this->Text = L"Form1";
    			this->menuStrip1->ResumeLayout(false);
    			this->menuStrip1->PerformLayout();
    			this->ResumeLayout(false);
    			this->PerformLayout();
     
    		}
    #pragma endregion
    	private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 }
    	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    				 Close();
    			 }
    	private: System::Void fermerToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    				 Close();
    			 }
        private: System::Void couperToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    				 //methode cut(); pose pb
    			 }
    	};
    }

  2. #2
    Membre émérite Avatar de Guulh
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    2 160
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2007
    Messages : 2 160
    Points : 2 925
    Points
    2 925
    Par défaut
    Salut,
    Citation Envoyé par siro1 Voir le message
    Lorque j'utilise la methode Cut(); le compilateur m'insulte.
    Précisément ? Et de quelle méthode Cut parles-tu ?
    ಠ_ಠ

  3. #3
    Membre habitué
    Homme Profil pro
    Inscrit en
    Septembre 2009
    Messages
    311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2009
    Messages : 311
    Points : 127
    Points
    127
    Par défaut
    Dans visual studio on me propose une methode "cut ", je parle de ça. . .


    System.Void Cut()
    Membre de System.Windows.Forms.TextBoxBase

    Résumé*:
    Déplace la sélection active entre la zone de texte et le Presse-papiers.

  4. #4
    Membre émérite Avatar de Guulh
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    2 160
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2007
    Messages : 2 160
    Points : 2 925
    Points
    2 925
    Par défaut
    Cette méthode est un membre de Textbox. Il faut donc que tu appelles taTextbox->Cut(), où "taTextBox" est le nom de la textbox qui contient le texte que tu veux couper.
    ಠ_ಠ

  5. #5
    Membre actif Avatar de gibet_b
    Profil pro
    Inscrit en
    Mars 2002
    Messages
    292
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France

    Informations forums :
    Inscription : Mars 2002
    Messages : 292
    Points : 296
    Points
    296
    Par défaut
    Le sujet de ce post est "Fontion pour couper du text en C++ dans un TextArea" et on est dans le forum C#. Y a pas comme un bug déjà ?
    Jean-Baptiste, vieux membre éclairé à la bougie
    -----
    www.e-jbb.net : Écriture et lecture numérique
    ---
    Citation du moment : "On abdique pas l'honneur d'être une cible" - Cyrano De Bergerac

  6. #6
    Membre émérite Avatar de Guulh
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    2 160
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Septembre 2007
    Messages : 2 160
    Points : 2 925
    Points
    2 925
    Par défaut
    C'est en C++/CLI, là. Son souci a pas vraiment de lien avec le langage, mais plutôt avec le framework.

    D'ailleurs, siro1, si tu n'as pas de contrainte d'interop ou de code existant à intégrer à du .Net, je te conseille vivement d'utiliser C# plutôt que C++/CLI pour ton projet, au moins pour sa partie graphique
    ಠ_ಠ

Discussions similaires

  1. [HTML 4.0] Texte qui disparaît dans le textarea
    Par jlb59 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 23/09/2011, 19h19
  2. Inserer texte "tout fait" dans un textarea
    Par beral dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 26/04/2008, 21h31
  3. Réponses: 2
    Dernier message: 09/04/2007, 21h52
  4. Problème pour ajouter un texte automatique dans un zone de saisie de texte
    Par koKoTis dans le forum Balisage (X)HTML et validation W3C
    Réponses: 6
    Dernier message: 21/08/2006, 16h03
  5. Besoin d'aide pour afficher du text dans un applet
    Par argon dans le forum Applets
    Réponses: 2
    Dernier message: 15/01/2006, 21h53

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