I have set up my program so that the user can enter a new line into the combo box via a text box on a separate form (Popup form). So far the program allows the new entry and closes the popup form when the user presses the "Accept" button however the entry does not appear in the combobox and the entry is not saved.
Currently the only way to view the new entry is by the .ShowDialog(); function which opens a second instance of the first form.
Form 2
namespace RRAS
{
public partial class NewRFRPopup : Form
{
public NewRFRPopup()
{
InitializeComponent();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnAccept_Click(object sender, EventArgs e)
{
formRRAS main = new formRRAS();
string newRFR = txtNewRFR.Text;
main.AddRFR(newRFR);
this.Close();
main.ShowDialog();
}
private void NewRFRPopup_Load(object sender, EventArgs e)
{
}
}
}
AddRFR in Form 1
public void AddRFR(object item)
{
cmbRFR.Items.Add(item);
}