//end placeholders private void loadAuthInto_ListBox() { List <authDTO> listAuth = authBUS.selectedAuth(); List <typeDTO> listType = typeBUS.selectedTypes(); if (lsbAuth == null) { MessageBox.Show("DB chưa có thông tin của bất cứ tác giả nào"); return; } if (lsbType == null) { MessageBox.Show("DB chưa có thông tin của bất cứ tác giả nào"); return; } lsbAuth.DataSource = new BindingSource(listAuth, String.Empty); lsbAuth.DisplayMember = "TenTacGia"; lsbAuth.ValueMember = "MaTacGia"; lsbType.DataSource = new BindingSource(listType, String.Empty); lsbType.DisplayMember = "TenTheLoai"; lsbType.ValueMember = "MaTheLoai"; CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[lsbAuth.DataSource]; myCurrencyManager.Refresh(); if (lsbAuth.Items.Count > 0) { lsbAuth.SelectedIndex = 0; } }
//to load data in to datagridview control private void LoadDataInto_DataGridViewOfType() { List <typeDTO> listTypes = typeBUS.selectedTypes(); if (listTypes == null) { MessageBox.Show("Chưa có thông tin thể loại"); } dgvTypesManage.Columns.Clear(); dgvTypesManage.DataSource = null; dgvTypesManage.ReadOnly = true; dgvTypesManage.AutoGenerateColumns = false; dgvTypesManage.AllowUserToAddRows = false; dgvTypesManage.DataSource = listTypes; DataGridViewTextBoxColumn clTypeCode = new DataGridViewTextBoxColumn(); clTypeCode.Name = "typeCode"; clTypeCode.HeaderText = "Mã thể loại"; clTypeCode.DataPropertyName = "maTheLoai"; dgvTypesManage.Columns.Add(clTypeCode); DataGridViewTextBoxColumn clTypeName = new DataGridViewTextBoxColumn(); clTypeName.Name = "typeName"; clTypeName.HeaderText = "Tên thể loại"; clTypeName.DataPropertyName = "tenTheLoai"; dgvTypesManage.Columns.Add(clTypeName); }