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

Getting state updates from a listbox on a seperate form.

$
0
0

Hello,

In my main form, form1, i have an instance of my secondary form, form2.

 public partial class Form1 : Form
{
    Form2 f2;
    public Form1(Form2 frm2)
    {
       f2 = frm2;
       int count = f2.lstListBox.Items.Count;
       lblCount.Text = count.ToString();
    }

    private void Button_Click(object sender, EventArgs e)
    {
       Form2 popup = new Form2();
       popup.show();
    }
}
       
              

In Form2,

I have some simple commands to add and remove items from the ListBox. How do I keep Form1 updated with these changes? I've tried a million and one things all weekend but none of them seemed to work. does anyone have any examples they'd be willing to share?

Thanks


Malik


Viewing all articles
Browse latest Browse all 31927

Trending Articles



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