Answer the question
In order to leave comments, you need to log in
How to display text in a form in windows forms?
The bottom line is that there is a piece of code that displays the result of the work in the console, but it is necessary that it displays windows forms on the screen, a few hours of googling did not help
int a = 1;
int b = a;
int c;
for (int i = 0; i < 8; i++) {
c = a + b;
a = b;
b = c;
Console.WriteLine(c);
System.Threading.Thread.Sleep(1000);
}
Answer the question
In order to leave comments, you need to log in
int a = 1;
int b = a;
int c;
//Создаем форму
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
//Задаем размер
form.Size = new System.Drawing.Size(640, 480);
//Создаем текстовое поле
System.Windows.Forms.RichTextBox richTextBox = new System.Windows.Forms.RichTextBox();
//Задаем размер поля на всю форму
richTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
//Добавляем поле на форму
form.Controls.Add(richTextBox);
for (int i = 0; i < 8; i++) {
c = a + b;
a = b;
b = c;
//Записываем значение текста с новой строки
richTextBox.Text = richTextBox.Text + c + System.Environment.NewLine;
System.Threading.Thread.Sleep(1000);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question