First of all I write a class in a seperate file as this
using System;
using System.Windows.Forms
public class Watcher
{
private System.Windows.Forms.ComboBox combo;
public Watcher()
{
}
public Watcher(ref System.Windows.Forms.ComboBox cb)
{
this.combo = cb;
}
public void AddItem()
{
this.combo.Items.Add("SerhaD");
}
}
Both Form1 and Form 2 have an instance of this class. In The Form 1 it is a
private, Form2's is public member
//////In your Form1.comboBox fill function do
watcherForm1 = new Watcher(ref comboBox1);
//////while constructing Form2 Do this
Form2 f2 = new Form2();
f2.watcherForm2 = watcherForm1;
fe.ShowDialog();
/////// In the Form2 you may call AddItem function of Watcher Class
watcherForm2.AddItem(); //this adds SerhaD to the combo
////Turn to the Form1 and Look at the Combo and that's it
SerhaD is added to the Combo from Form2 !
Hope you get the idea ,
"A. Chiou" <A.
Ch***@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Hi:
I have a combobox (in form 1) whose items are populated from a table. In
form 2 there is a data entry for the same table. How do I reflect the
changes to the combobox in form 1 as soon as the data entered in form 2 is
saved in the table? Thanks in advance.