using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WinformDevFramework.Core.Configuration; namespace WinformDevFramework { public partial class Form1 : Form { public Form1() { InitializeComponent(); comboBox1.DataSource = new List() { new User() { id = 1, name = "ww" }, new User() { id = 2, name = "kk" } }; comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; } private void button1_Click(object sender, EventArgs e) { string id = comboBox1.SelectedValue.ToString(); //throw new Exception("测试"); AppSettingsHelper.SetContent("11211", "Update", "Version"); } private void button2_Click(object sender, EventArgs e) { TabControl parentTabControl = this.Parent.Parent as TabControl; TabPage tabpage = this.Parent as TabPage; parentTabControl.TabPages.Remove(tabpage); } } class User { public int id { get; set; } public string name { get; set; } } }