miércoles, 25 de enero de 2012

AGREGAR DATOS A UN DATAGRIDVIEW


Public Class Frm04

    Private Sub btnadd_Click(ByVal sender As System.ObjectByVal e AsSystem.EventArgsHandles btnadd.Click
        If TxtCod.Text = "" Then
            MsgBox("Ingrese Codigo")
            Exit Sub
        End If
        If Txtemail.Text = "" Then
            MsgBox("Ingrese Email")
            Exit Sub
        End If
        If TxtNom.Text = "" Then
            MsgBox("Ingrese Nombre")
            Exit Sub
        End If
        If TxtTel.Text = "" Then
            MsgBox("Ingrese Telefono")
            Exit Sub
        End If
        DGVAgenda.Rows.Add(TxtCod.Text.ToUpper, TxtNom.Text.ToUpper, TxtTel.Text.ToUpper, Txtemail.Text)
        Call Nuevo()
    End Sub
    Private Sub Nuevo()
        TxtCod.Clear()
        Txtemail.Clear()
        TxtNom.Clear()
        TxtTel.Clear()
    End Sub

    Private Sub Btndel_Click(ByVal sender As System.ObjectByVal e AsSystem.EventArgsHandles Btndel.Click
        If DGVAgenda.SelectedRows.Count = 0 Then
            MsgBox("Seleccione Item")
            Exit Sub
        End If
        DGVAgenda.Rows.RemoveAt(DGVAgenda.CurrentCell.RowIndex)
    End Sub

End Class

1 comentario:

  1. Todo es correcto en cuanto a Agregar y eliminar, pero no completo con los puntos de Actualizar y Buscar, puntos que me hubiesen gustado ver como se ejecutan.
    En realidad la labor de docente contempla precisamente evitar estos errores, por que solo dejan dudas que evitan que la presentacion fue completa.

    ResponderEliminar