private void FormHocTap_Load(object sender, EventArgs e)
        {
            //Tạo bộ từ vựng
            btv            = new BoTuVung();
            btv.ListTuVung = new List <TuVung>();
            check          = new List <bool>();
            foreach (TuVung tv in ptbChe.Btv.ListTuVung)
            {
                btv.ListTuVung.Add(tv);
                check.Add(false);
            }

            i = 0;

            Scene();
        }
Esempio n. 2
0
        void LoadBoTu()
        {
            try
            {
                lvDanhSachBoTu.Items.Clear();
                cmbTenBo.Items.Clear();

                conn = new SqlConnection(TenChuoi.ketNoi);

                conn.Open();
                string query = @"select btv.TenBoTuVung, btv.GhiChu from BoTuVung btv where btv.TenBoTuVung != N'admin'";

                SqlCommand    cmd  = new SqlCommand(query, conn);
                SqlDataReader read = cmd.ExecuteReader();

                //Tên những bộ từ vựng
                while (read.Read())
                {
                    ListViewItem item = new ListViewItem(read["TenBoTuVung"].ToString());
                    item.SubItems.Add(XuLyDuLieu.ChuyenQuaGiaoDien(read["GhiChu"].ToString()));
                    //item.ImageList.Images = imgAnh.Images[0];

                    lvDanhSachBoTu.Items.Add(item);
                    lvDanhSachBoTu.Items[lvDanhSachBoTu.Items.Count - 1].ImageIndex = 0;

                    cmbTenBo.Items.Add(read["TenBoTuVung"].ToString());
                }

                btv = new BoTuVung();
            }
            catch (SqlException)
            {
                MessageBox.Show("Kết nối thất bại", "Lỗi kết nối", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
            }
        }