Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

when accessing variables from one form to another I cannot get it to update

$
0
0

I have 2 forms (FormMain & Live)

I need to populate a textbox in form Live with variables from FormMain and continue to update the textbox.

In FormMain I have .......

        private void timer1_Tick(object sender, EventArgs e)
        {
            Live livea = new Live(MTotals, RTotals);
        }
        private void menuItem13_Click(object sender, EventArgs e)
        {
            Live livea = new Live(MTotals, RTotals);
            livea.Show();
            timer1.Enabled = true;
        }

In Form Live I have.......

         public Live(string valueMT, string valueRT)
        {
            InitializeComponent();
            textBox1.Text = valueMT;
            textBox2.Text = valueRT;
     }

As I step through I can see that valueMT and valueRT are updateing however the textboxes don't.

If I change FormMain timer1 by adding "livea.Show();" the textboxes do update however with each update a new windows form is opened.

I only want to update the texbox NOT open a new "Live" form.

Any Ideas??

Thanks

Tac


tac


Viewing all articles
Browse latest Browse all 31927


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>