E
E
Eugene Chefranov2020-05-26 22:26:46
C++ / C#
Eugene Chefranov, 2020-05-26 22:26:46

How to build a string correctly?

There is a form
5ecd6ab9021a1225529806.png
There are two GroupBox with ComboBox and TextBox

var startCompoundsList = startCompounds.Controls.OfType<ComboBox>();  // Список ComboBox начала реакции
    var endCompoundsList = endCompounds.Controls.OfType<ComboBox>();    // Список ComboBox конца реакции
    var startMultipleList = startCompounds.Controls.OfType<TextBox>();           // Список TextBox начала реакции
    var endMultipleList = endCompounds.Controls.OfType<TextBox>();              // Список TextBox конца реакции

Based on the selected ComboBox, it is necessary to visually display the reaction: Following the example of the picture, it should come out: The catch is that the intermediate ComboBox and TextBox can be empty and it is necessary that it does not turn out like: 1γAl2O3+ 1+ 2SiO2(β-quartz)+2H2O = Al2O3 2SiO2 2H2O 1+1+1+ How to implement this?
reactionText.Text = "";
γAl2O3+2SiO2(β-кварц)+2H2O = Al2O3·2SiO2·2H2O

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-05-26
@Chefranov

StringBuilder sb = new StringBuilder();
 sb.Append("первая");
 sb.Append("вторая");
if(value != 1)  sb.Append("строка не равная 1");

 sb.Append("третья");

https://docs.microsoft.com/ru-ru/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question