Exemplo n.º 1
0
        public FormProfile(string id)
        {
            InitializeComponent();
            metroComboBoxHometown.DataSource    = DataUlti.DSQueQuan();
            metroComboBoxHometown.DisplayMember = "TenDiaPhuong";
            metroComboBoxHometown.ValueMember   = "MaVung";

            HocSinh sv = DataUlti.TimHocSinh(id);

            dateTimePickerBirthday.Format       = DateTimePickerFormat.Custom;
            dateTimePickerBirthday.CustomFormat = "dd-MM-yyyy";

            metroTextBoxID.Text   = sv.MaHocSinh;
            metroTextBoxName.Text = sv.TenHocSinh;
            try
            {
                metroComboBoxHometown.SelectedValue = sv.QueQuan;
                dateTimePickerBirthday.Value        = sv.NgaySinh.Value;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            metroTextBoxClass.Text = sv.Lop;
            metroTextBoxGrade.Text = sv.Khoi.ToString();

            metroRadioButtonMale.Checked   = sv.GioiTinh == true ? true : false;
            metroRadioButtonFemale.Checked = sv.GioiTinh == false ? true : false;
        }
Exemplo n.º 2
0
        private void ReloadForm()
        {
            metroComboBoxHometown.DataSource    = null;
            metroComboBoxHometown.DataSource    = DataUlti.DSQueQuan();
            metroComboBoxHometown.DisplayMember = "TenDiaPhuong";
            metroComboBoxHometown.ValueMember   = "MaVung";
            HocSinh sv = DataUlti.TimHocSinh(metroTextBoxID.Text);

            metroTextBoxName.Text               = sv.TenHocSinh;
            dateTimePickerBirthday.Value        = sv.NgaySinh.Value;
            metroComboBoxHometown.SelectedValue = sv.QueQuan;
            metroRadioButtonMale.Checked        = sv.GioiTinh == true ? true : false;
            metroRadioButtonFemale.Checked      = sv.GioiTinh == false ? true : false;
        }