Тема: Оголошення власних функцій в Windows form
Вибиває помилку при виконанні
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public static string CreateHrom(int left_b, int right_b)
        {
            int hrom;
            Random rnd = new Random();
            hrom = rnd.Next(left_b, right_b);
            return Convert.ToString(hrom, 2);
        }
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int left_b, right_b, pop_size;
            string hrom;
            left_b = Convert.ToInt16(textBox1);
            right_b = Convert.ToInt16(textBox2);
            pop_size = Convert.ToInt16(textBox3);
            for (int i = 0; i < pop_size; i++)
            {
                hrom = CreateHrom(left_b,right_b);
                listBox1.Items.Add(hrom);
            }
        }
    }
}