Text box problem

  • Thread starter Thread starter Lian
  • Start date Start date
L

Lian

Hi everybody
I have a problem .I have a textbox although the TextMode property is
multyline I can't write in a several rows
What can I do?
tnx
lian
 
HI
I used new line characters. Can you give me an example how to write
several rows in textbox?
 
Lian Bar said:
I used new line characters. Can you give me an example how to write
several rows in textbox?

Hi Lian,

you can try this code:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Newsgroup
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
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.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
// textBox1
this.textBox1.Location = new System.Drawing.Point(64, 72);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(152, 104);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "textBox1\\ntest";
// Form1
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
string nL = Environment.NewLine;
string oL = "This is one Line";
this.textBox1.Text = oL + nL + oL + nL + oL + nL + oL + nL + oL + nL;
}
}
}

You can create a new windows form project and replace all the automatic
generated code with the one above - that should work.
HTH! Greetings,
Tim.
 
Back
Top