I'm programming in C # in Visual Studio 2015, and I have a form with a checkedListBox with names of several courses. (The registration is for a student).
By marking and saving, it saves the student's enrollment in the students table, and presents me to my datagridview, where it server for viewing
I need now that when I edit the student's registry, the checkedListBox are checked, in the options that were marked at the time of insertion, but I'm not able to do this, I'm using the datagridview itself to perform the update, that is when I click on the cell of the datagridview it opens another form for me to update the register, I just can not get the information from my checkedlistbox.
In short:
I need to pull the bank and check the CheckedListBox options that have been marked at the student's insertion.
This is my code that throws information from my datagridview to my update form.
private void DG_edit_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Tela_EditarAluno fmr = new Tela_EditarAluno();
fmr.TB_cod.Text = DG_edit.CurrentRow.Cells["Cod"].Value.ToString();
fmr.TB_nome.Text = DG_edit.CurrentRow.Cells["Nome"].Value.ToString();
fmr.TB_idade.Text = DG_edit.CurrentRow.Cells["Idade"].Value.ToString();
fmr.TB_endereco.Text = DG_edit.CurrentRow.Cells["Endereço"].Value.ToString();
fmr.TB_quadra_lote.Text = DG_edit.CurrentRow.Cells["Quadra"].Value.ToString();
fmr.MD_telefoneFixo.Text = DG_edit.CurrentRow.Cells["Residencial"].Value.ToString();
fmr.MD_telefoneCel.Text = DG_edit.CurrentRow.Cells["Celular"].Value.ToString();
fmr.TB_cidade.Text = DG_edit.CurrentRow.Cells["Cidade"].Value.ToString();
fmr.TB_uf.Text = DG_edit.CurrentRow.Cells["Uf"].Value.ToString();
fmr.TB_email.Text = DG_edit.CurrentRow.Cells["Email"].Value.ToString();
fmr.TB_nomepai.Text = DG_edit.CurrentRow.Cells["Pai"].Value.ToString();
fmr.TB_nomemae.Text = DG_edit.CurrentRow.Cells["Mãe"].Value.ToString();
fmr.CB_ativo.Text = DG_edit.CurrentRow.Cells["Ativo"].Value.ToString();
fmr.ShowDialog();
}
I forgot to mention my checklistbox, which is why I took two prints from the initial sign-up screen and edit screen. insert the description of the image here
This image is from the edit screen.
Thisismyhomescreenforregisteringwithmycheckedlistbox"ACTIVITIES", "OBS: this column is from my students table" I have an Activities column where it plays my STRINGS that have been inserted by the checkedlistbox. and when I click on the cell of the datagridview no as in the first print of edit it has to check and mark the items that were registered in the screen of registration.