Guest User

Untitled

a guest
Jan 11th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. try
  2. {
  3. id = Int32.Parse(dataGridView1.CurrentRow.Cells["id_curso"].Value.ToString());
  4. row = dataGridView1.CurrentRow.Index;
  5.  
  6. datos[0] = dataGridView1.CurrentRow.Cells["titulo"].Value.ToString();//todos los datos del dataGrid y mostrar los datos en los txt correspondientes
  7. datos[1] = dataGridView1.CurrentRow.Cells["cod_curso"].Value.ToString();
  8. datos[2] = dataGridView1.CurrentRow.Cells["descripcion"].Value.ToString();
  9. datos[3] = dataGridView1.CurrentRow.Cells["horas"].Value.ToString();
  10. datos[4] = dataGridView1.CurrentRow.Cells["id_curso"].Value.ToString();
  11. txtTitulo.Text = datos[0];
  12. txtCodcurso.Text = datos[1];
  13. txtDescripcion.Text = datos[2];
  14. txtHoras.Text = datos[3];
  15. }
  16. catch (System.NullReferenceException) {
  17.  
  18. MessageBox.Show("Los datos de este curso estan corruptos y no se pueden visualizar"); }
  19. }
  20.  
  21. Console.WriteLine("DataGridView actualizado");
  22. var list = await Task.Run(async () =>
  23. {
  24. return await _api.ObtenerCursos(string.Empty);
  25. });
  26. dataGridView1.DataSource = list;
  27. dataGridView1.ClearSelection();
  28.  
  29. try
  30. {
  31. dataGridView1.Rows[row].Cells[0].Selected = true;
  32. //dataGridView1.Rows[row].Selected = true;
  33. }
  34. catch (System.ArgumentOutOfRangeException) { }
  35.  
  36. }
Add Comment
Please, Sign In to add comment