Seleccionamos Visual C# Windows Aplicacin para Windows, escribimos el nombre del proyecto en este
caso he puesto AplicacionADO, por ultimo presionamos el botn aceptar
Creamos el formulario estudiantes, haciendo clic derecho en el proyecto, desde el explorador de objetos
como se muestra en la siguiente imagen:
Objeto
GroupBox1 (Dentro de este control irn todos
los siguientes)
Text
labell
TextBox1
label2
TextBox2
label3
TextBox3
label4
TextBox4
Propiedad
name
Valor
GroupBox1
Informacin bsica
name
text
name
name
text
name
name
text
name
name
text
name
lblIdentificacion
Identificacin
txtIdentificacion
lblPri_nom
Primer nombre
txtPri_nom
lblSeg_nom
Segundo nombre
txtSeg_nom
lblPri_ape
Primer apellido
txtPri_ape
label5
TextBox5
label6
ComboBox1
Label7
TextBox6
GroupBox1 (Dentro de este control irn todos
los siguientes)
text
button1
button2
button3
button4
button5
text
button6
text
button7
text
button8
text
button9
text
name
text
name
name
text
name
name
text
name
name
Acciones
name
text
name
text
name
text
name
text
name
Guardar
name
Editar
name
Buscar
name
Eliminar
name
Cerrar
lblSeg_ape
Segundo apellido
txtSeg_ape
cboGenero
Genero
cboGenero
lblTelefono
Telfono
txtTelefono
GroupBox2
btnPrimero
<<
btnAnterior
<
btnSiguiente
>
btnUltimo
Ultimo
btnGuardar
btnEditar
btnBuscar
btnEliminar
btnCerrar
}
private void btnEliminar_Click(object sender, EventArgs e)
{
Sql = delete from estudiantes where identificacion=@identificacion;
Comando = new SqlCommand(Sql, Conexion);
Comando.Parameters.AddWithValue(@identificacion, txtIdentificacion.Text);
try
//Bloque try catch para captura de excepciones en ejecucin
{
Comando.ExecuteNonQuery();
MessageBox.Show(Registro eliminado);
RefrescarDatos();
}
catch (SqlException ex)
{
MessageBox.Show(Error: + ex.Message);
}
}
private void btnPrimero_Click(object sender, EventArgs e)
{
indice = 0;
CargarDatos(indice);
}
private void btnAnterior_Click(object sender, EventArgs e)
{
if (Tabla.Rows.Count > 0 && indice > 0)
{
indice = indice 1;
CargarDatos(indice);
}
}
private void btnSiguiente_Click(object sender, EventArgs e)
{
if (indice < Tabla.Rows.Count -1)
{
indice = indice + 1;
CargarDatos(indice);
}
}
private void btnUltimo_Click(object sender, EventArgs e)
{
if (Tabla.Rows.Count > 0)
{
indice = Tabla.Rows.Count 1;
CargarDatos(indice);
}
}
}
}