методом тыка сделал кнопку и вывод результата в окно TextBox1
но есть вопрос
как мне вместо того что бы вписывать значение int z = 500; вводить его в окошко TextBox2
что нужно изменить в коде проги?

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int i = 0; int x = 0; [color=#FF0000]int z = 500;[/color] for (;; ) { i++; Random T = new Random(); int y = T.Next(0, 2); Console.WriteLine(y); if (y == 1) { x = x + 1; if (x > z) { textBox1.Text = "ошибка на " + i + " цикле"; x = 0; //z = int.Parse(Console.ReadLine()); i = 0; break; } } else { x = 0; } } } private void textBox1_TextChanged(object sender, EventArgs e) { } [color=#FF0000]private void textBox2_TextChanged(object sender, EventArgs e) {[/color] } } }