Ou pour un fichier :(tjr avec la propiété Multiline = true du textbox)
StreamReader sr = new StreamReader(File.OpenRead(@"c:\lefichier.txt"));
textbox.Text = sr.ReadToEnd(); ou textbox.AppendText(sr.ReadToEnd());
sr.Close();
-------------------------------
Réponse au message :
-------------------------------
> Hummm je sais pas trop si c ce que tu attends mais pour un textbox le "\r\n" (vbCrLf) est bien pris en compte si la propiété Multiline du textbox est à true.
> Tu peux dans ce cas faire ceci :
>
> string txt = "Une phrase!";
> textbox.AppendText(txt); ou textbox.Text += txt + "\r\n";
>
> pour les tabulations c pareil:
> textbox.AppendText("\t" + txt); ou textbox.Text += "\t" + txt + "\r\n";
>
> En espérant que ct ce que tu voulais lire.
>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > Salut,
> >
> > Pour la Form, voici du code qui fonctionne :
> > using System;
> > using System.Drawing;
> > using System.Collections;
> > using System.ComponentModel;
> > using System.Windows.Forms;
> > using System.Data;
> >
> > namespace WindowsApplication1
> > {
> >
> > public class Form1 : System.Windows.Forms.Form
> > {
> >
> > private System.ComponentModel.Container components = null;
> >
> > public Form1()
> > {
> > InitializeComponent();
> > }
> > protected override void Dispose( bool disposing )
> > {
> > if( disposing )
> > {
> > if (components != null)
> > {
> > components.Dispose();
> > }
> > }
> > base.Dispose( disposing );
> > }
> > private void InitializeComponent()
> > {
> > this.components = new System.ComponentModel.Container();
> > this.Size = new System.Drawing.Size(300,300);
> > this.Text = "Form1";
> > }
> > [STAThread]
> > static void Main()
> > {
> > Application.Run(new Form1());
> > }
> >
> >
> >
©ªþ§Lð¢K
> >
>