Answer the question
In order to leave comments, you need to log in
How to display text with parameters {0} in c# in TextBox?
I need to display a lot of text with a lot of variables in a TextBox, but I don't want to write a lot of plus signs and quotes so as not to get confused.
string myString = "World";
textBox1.Text = "Hello {0} !",myString;
Answer the question
In order to leave comments, you need to log in
add.
in c# (version 6) there is such an opportunity (not to use numbers):
string bla = "первое слово";
string bla2 = "второе слово";
textBox1.Text = string.Format($"({bla}, {bla2})"); //знак $ нужен для того, чтобы сказать, что тут именованные переменные нужно брать
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question