-1

example:

textbox1.Text[0]="a";
textbox1.Text[1]="s";

so,the text appear in textbox1 is "as"

is there a way to do that?

Dmitry
  • 13,797
  • 6
  • 32
  • 48
RasAlGhul
  • 3
  • 2

2 Answers2

6

No, strings are immutable. You can't manipulate strings like that, you need to create a new string and assign it to your Text property. You can assign it directly:

textBox1.Text="as";

Or you can use a StringBuilder:

var builder = new StringBuilder();
builder.Append("a");
builder.Append("s");
textBox1.Text = builder.ToString();
Selman Genç
  • 100,147
  • 13
  • 119
  • 184
-3
textbox1.Text="a";

And than, to add more characters to that string use

textbox1.Text +="s";
Sefa
  • 8,865
  • 10
  • 51
  • 82