private void scSearchCity_SelectClick(object sender, EventArgs e) { AreaSortCityForm SelectCity = new AreaSortCityForm(); SelectCity.SelectedClicked += (obj, ea) => { scSearchCity.TxtSelectedCity.Text = SelectCity.Result.Keys.FirstOrDefault(); citycode = SelectCity.Result[SelectCity.Result.Keys.FirstOrDefault()].ToString(); }; var windows = SMT.SAAS.Controls.Toolkit.Windows.ProgramManager.ShowProgram(Utility.GetResourceStr("SELECTEDCITY"), "", "123", SelectCity, false, false, null); if (SelectCity is AreaSortCityForm) { (SelectCity as AreaSortCityForm).Close += (o, args) => { windows.Close(); }; } }