1、textBox
賦值:textBox1.Text = “A”;
取值:string A = textBox1.Text;
2、comboBox
賦值:
ArrayList mylist = new ArrayList();
mylist.Add(new DictionaryEntry("1", "正常"));
mylist.Add(new DictionaryEntry("2", "終止"));
comboBox1.DataSource = mylist;
comboBox1.DisplayMember = "Value";
comboBox1.ValueMember = "Key";
取值:comboBox1.SelectedValue = “1”;
3、dateTimePicker
賦值:dateTimePicker1.Value = (DateTime)“2019-05-01”;
取值:string startDate = dateTimePicker1.Value.ToString("yyyy-MM-dd");
4、checkBox
賦值(默認選中):checkBox1.Checked = true;
取值:bool c = checkBox1.Checked (選中爲true,不選爲false)