public Form1()
        {
            InitializeComponent();
            r = new RateClass();
            new Thread(() => r.Start()).Start();

            System.Timers.Timer t = new System.Timers.Timer(500);
            t.Elapsed += (s, e) => { this.BeginInvoke(new Action(() => this.textBox1.Text = r.Rate.ToString() ) ); };
            t.Start();
        }
 public void GenNum(RateClass r)
 {
     Random num = new Random(); r.Rate = num.Next(100);
 }