SlideShare a Scribd company logo
1 of 7
Hola, tengo un problema. Estoy haciendo un mantenimiento en capas usando visual studio 2008 y sql server 2008.

Tengo un formulario llamado mantEmpleados (mantenimiento de empleados), textboxs para ingresar / mostrar datos y botones para ingresar un
"Nuevo" registro, "Grabar", etc.

He creado un procedimiento en SQL Server el cual va a generar un codigo creciente a partir del ultimo numero en el campo CodEmp (codigo
empleado), es decir: si encuentra el ultimo EMP001, el procedimiento generara el siguiente que seria EMP002. Hasta ahi todo va normal.

El problema se presenta cuando paso a las capas, primero pongo la funcion en la capa DATOS, luego paso a NEGOCIO y al final cuando deseo que
al hacer click en el boton "NUEVO" se muestre unicamente el codigo nuevo que ha generado, no muestra nada y queda en blanco.

Cabe decir que para borrar todo estoy usando un for each control txtbox.

Recalco que al momento de hacer click en NUEVO quiero que se cargue el codigo generado en el "tbcodigo.text"

Les pongo el codigo tanto del sql como del vb y agradezco desde ya su ayuda.

Script de SQL:

use TomyShop
go
Create Proc ListarEmpleados
as
select * from Empleados
go

Create Proc GrabarEmpleados
           @Nombres nvarchar(100),
           @Cargo nvarchar(50),
           @Planilla nvarchar(2),
           @Direccion nvarchar(100),
           @Pais nvarchar(60),
           @Ciudad nvarchar(60),
           @Dni int,
@Telefono nvarchar(20),
          @Celular nvarchar(20),
          @Email nvarchar(100),
          @Sexo nvarchar(9),
          @FIngreso date,
          @FSalida date,
          @Nhijos int,
          @FNacimiento date,
          @Edad int,
          @Sueldo decimal(6,2),
          @Imagen image
as
declare @CodEmp nvarchar(7)
set @CodEmp=(select 'EMP'+ right('000'+ltrim(right(MAX(CodEmp),2)+1),3) from Empleados)
insert into Empleados
values(@CodEmp,@Nombres,@Cargo,@Planilla,@Direccion,@Pais,@Ciudad,@Dni,@Telefono,@Celular,@Email,@Sexo,@FIngreso,@FSalida,@Nhijos,@F
Nacimiento,@Edad,@Sueldo,@Imagen)
go
exec grabarempleados 'Andres Lopez Casereso','Ayudante','SI','Jr. Polacal
312','Perú','Lima',41657464,'3224986','924589403','andrelope@gmail.com','Masculino','01/02/2004','',1,'10/01/1982',30,1600.00,''
go

Create Proc GenerarCodEmp
as
select 'EMP'+ right('000'+ltrim(right (MAX(CodEmp),2)+1),3) from Empleados
go

Capa DATOS: classdatos.vb

Imports System.Data.SqlClient
Imports Microsoft.ApplicationBlocks.Data
Imports Entidad
Public Class classdatos
  Dim cn As New SqlConnection("Server=.; Integrated security=sspi; database=TomyShop")
  Public Function generarcodemp() As String
     Return SqlHelper.ExecuteNonQuery(cn, "generarcodemp")
End Function
  Public Function listarempleados() As DataTable
     Return SqlHelper.ExecuteDataTable(cn, "listarempleados")
  End Function
  Public Function grabarempleados(ByVal ent As classentidad) As Integer
     Return SqlHelper.ExecuteNonQuery(cn, "grabarempleados", ent.Nombres, ent.Cargo, ent.Planilla, ent.Direccion, ent.Pais, ent.Ciudad, ent.Dni, ent.Telefono,
ent.Celular, ent.Email, ent.Sexo, ent.FIngreso, ent.FSalida, ent.Nhijos, ent.FNacimiento, ent.Edad, ent.Sueldo, ent.Imagen)
  End Function
End Class




Capa ENTIDAD: classentidad.vb

Public Class classentidad
  Public CodEmp, Nombres, Cargo, Planilla, Direccion, Pais, Ciudad, Telefono, Celular, Email, Sexo As String
  Public Dni, Nhijos, Edad As Integer
  Public Sueldo As Decimal
  Public FIngreso, FSalida, FNacimiento As Date
  Public Imagen() As Byte
End Class




Capa NEGOCIO: classentidad.vb

Imports Entidad
Imports Datos
Public Class classnegocio
  Dim datos As New classdatos
  Public Function generarcodemp() As String
     Return datos.generarcodemp
  End Function
  Public Function listarempleados() As DataTable
Return datos.listarempleados
  End Function
  Public Function grabarempleados(ByVal ent As classentidad) As Integer
    Return datos.grabarempleados(ent)
  End Function
End Class




Capa APLICACION: mantEmpleados.vb

Imports Negocio
Imports Entidad
Imports System.IO
Public Class mantEmpledos
  Dim NEG As New classnegocio
  Dim ENT As New classentidad
  Private Sub mantEmpledos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     dgvempleados.DataSource = NEG.listarempleados
  End Sub

  Private Sub dgvempleados_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgvempleados.CellClick
    btnmodificar.Enabled = True
    btneliminar.Enabled = True
    Try
       tbcodigo.Text = Me.dgvempleados.Item(0, e.RowIndex).Value
       tbnombres.Text = Me.dgvempleados.Item(1, e.RowIndex).Value
       cbocargo.Text = Me.dgvempleados.Item(2, e.RowIndex).Value
       cboplanilla.Text = Me.dgvempleados.Item(3, e.RowIndex).Value
       tbdireccion.Text = Me.dgvempleados.Item(4, e.RowIndex).Value
       cbopais.Text = Me.dgvempleados.Item(5, e.RowIndex).Value
       cbociudad.Text = Me.dgvempleados.Item(6, e.RowIndex).Value
       tbdni.Text = Me.dgvempleados.Item(7, e.RowIndex).Value
       tbtelefono.Text = Me.dgvempleados.Item(8, e.RowIndex).Value
tbcelular.Text = Me.dgvempleados.Item(9, e.RowIndex).Value
    tbemail.Text = Me.dgvempleados.Item(10, e.RowIndex).Value
    cbosexo.Text = Me.dgvempleados.Item(11, e.RowIndex).Value
    dtpfingreso.Text = Me.dgvempleados.Item(12, e.RowIndex).Value
    dtpfsalida.Text = Me.dgvempleados.Item(13, e.RowIndex).Value
    tbnhijos.Text = Me.dgvempleados.Item(14, e.RowIndex).Value
    dtpfnacimiento.Text = Me.dgvempleados.Item(15, e.RowIndex).Value
    tbedad.Text = Me.dgvempleados.Item(16, e.RowIndex).Value
    tbsueldo.Text = Me.dgvempleados.Item(17, e.RowIndex).Value
    Dim MyPhoto() As Byte = CType(Me.dgvempleados.Item(18, e.RowIndex).Value, Byte())
    Dim ms As New MemoryStream(MyPhoto)
    Me.pbimagen.Image = Image.FromStream(ms)
  Catch ex As Exception

  End Try

End Sub

Private Sub btngrabar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btngrabar.Click
  Dim ms As New MemoryStream
  pbimagen.Image.Save(ms, pbimagen.Image.RawFormat)
  ENT.CodEmp = tbcodigo.Text
  ENT.Nombres = tbnombres.Text
  ENT.Cargo = cbocargo.Text
  ENT.Planilla = cboplanilla.Text
  ENT.Direccion = tbdireccion.Text
  ENT.Pais = cbopais.Text
  ENT.Ciudad = cbociudad.Text
  ENT.Dni = tbdni.Text
  ENT.Telefono = tbtelefono.Text
  ENT.Celular = tbcelular.Text
  ENT.Email = tbemail.Text
  ENT.Sexo = cbosexo.Text
  ENT.FIngreso = dtpfingreso.Text
  ENT.FSalida = dtpfsalida.Text
  ENT.Nhijos = tbnhijos.Text
ENT.FNacimiento = dtpfnacimiento.Text
  ENT.Edad = tbedad.Text
  ENT.Sueldo = tbsueldo.Text
  ENT.Imagen = ms.GetBuffer
  NEG.grabarempleados(ENT)
  MsgBox("Registro Grabado")
  dgvempleados.DataSource = NEG.listarempleados
End Sub

Private Sub btnmodificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmodificar.Click

End Sub


Private Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click

End Sub

Private Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click
  Me.Close()
End Sub

Private Sub btnexaminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexaminar.Click
  With OpenFileDialog1
     .InitialDirectory = ""
     .FileName = "Todos los Archivos"
     .Filter = "Todos los Archivos |*.*|JPEGs|*.jpg|GIFs|*.gif|Bitmaps|*bmp|PNGs|*.png"
     .FilterIndex = 2
  End With

  If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
     pbimagen.Image = Image.FromFile(OpenFileDialog1.FileName)
  End If
End Sub

Private Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click
Dim limpiar As Control
    : For Each limpiar In Me.Controls
       : If (TypeOf limpiar Is TextBox) OrElse (TypeOf limpiar Is ComboBox) OrElse (TypeOf limpiar Is DateTimePicker) Then limpiar.Text = ""
       : Next
    pbimagen.Image = Nothing
    btnmodificar.Enabled = False
    btneliminar.Enabled = False

    tbcodigo.Text = ENT.CodEmp
    NEG.generarcodemp()
  End Sub
End Class

More Related Content

What's hot

Proyecto de un formulario de facturacion
Proyecto de un formulario de facturacionProyecto de un formulario de facturacion
Proyecto de un formulario de facturacionRoyer Tuesta Salas
 
Codigo de bajas en Visual Basic, Luis Angel Mena Martínez
Codigo de bajas en Visual Basic, Luis Angel Mena MartínezCodigo de bajas en Visual Basic, Luis Angel Mena Martínez
Codigo de bajas en Visual Basic, Luis Angel Mena MartínezEquipo1606
 
Problemas propuestos2.0
Problemas propuestos2.0Problemas propuestos2.0
Problemas propuestos2.0YO Por Que
 

What's hot (8)

Altas
AltasAltas
Altas
 
Proyecto de un formulario de facturacion
Proyecto de un formulario de facturacionProyecto de un formulario de facturacion
Proyecto de un formulario de facturacion
 
CodigoFelizLombriz
CodigoFelizLombrizCodigoFelizLombriz
CodigoFelizLombriz
 
Codigo de bajas en Visual Basic, Luis Angel Mena Martínez
Codigo de bajas en Visual Basic, Luis Angel Mena MartínezCodigo de bajas en Visual Basic, Luis Angel Mena Martínez
Codigo de bajas en Visual Basic, Luis Angel Mena Martínez
 
Problemas propuestos2.0
Problemas propuestos2.0Problemas propuestos2.0
Problemas propuestos2.0
 
Altas Julio Cesar Melendez Cano
Altas Julio Cesar Melendez CanoAltas Julio Cesar Melendez Cano
Altas Julio Cesar Melendez Cano
 
Codigo proceso
Codigo procesoCodigo proceso
Codigo proceso
 
Guia no4 ado.net
Guia no4 ado.netGuia no4 ado.net
Guia no4 ado.net
 

Viewers also liked

Assistive GPS for patients with RP
Assistive GPS for patients with RPAssistive GPS for patients with RP
Assistive GPS for patients with RPabhishek07887
 
Franco flemish school
Franco flemish schoolFranco flemish school
Franco flemish schoolsungchoi93
 
“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...
“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...
“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...abhishek07887
 
Nine Elements of Digital Citizenship
Nine Elements of Digital CitizenshipNine Elements of Digital Citizenship
Nine Elements of Digital Citizenshiperin_deegan
 
AR Location Notification Android Application
AR Location Notification Android ApplicationAR Location Notification Android Application
AR Location Notification Android Applicationabhishek07887
 
series de tiempo
series de tiemposeries de tiempo
series de tiempojvasquez213
 
Инсульт: быть иль не быть?
Инсульт: быть иль не быть?Инсульт: быть иль не быть?
Инсульт: быть иль не быть?Gulnara Samigulina
 
Case presentation to salzburg seminar of Samigulina G.R.
Case presentation to salzburg seminar of Samigulina G.R.Case presentation to salzburg seminar of Samigulina G.R.
Case presentation to salzburg seminar of Samigulina G.R.Gulnara Samigulina
 
Fable Revisted- Quest Generation using POP
Fable Revisted- Quest Generation using POPFable Revisted- Quest Generation using POP
Fable Revisted- Quest Generation using POPabhishek07887
 
các bài toán hình học lớp 9 có lời giải
các bài toán hình học lớp 9 có lời giảicác bài toán hình học lớp 9 có lời giải
các bài toán hình học lớp 9 có lời giảiKhoảnh Khắc Bình Yên
 

Viewers also liked (16)

Assistive GPS for patients with RP
Assistive GPS for patients with RPAssistive GPS for patients with RP
Assistive GPS for patients with RP
 
Franco flemish school
Franco flemish schoolFranco flemish school
Franco flemish school
 
“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...
“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...
“Spindex” (Speech Index) Enhances Menus on Touch Screen Devices with Tapping,...
 
Nine Elements of Digital Citizenship
Nine Elements of Digital CitizenshipNine Elements of Digital Citizenship
Nine Elements of Digital Citizenship
 
Zedge
ZedgeZedge
Zedge
 
Presentación1
Presentación1Presentación1
Presentación1
 
ARJUN CV
ARJUN CVARJUN CV
ARJUN CV
 
AR Location Notification Android Application
AR Location Notification Android ApplicationAR Location Notification Android Application
AR Location Notification Android Application
 
God tells
God tellsGod tells
God tells
 
AR Jenga
AR JengaAR Jenga
AR Jenga
 
series de tiempo
series de tiemposeries de tiempo
series de tiempo
 
Инсульт: быть иль не быть?
Инсульт: быть иль не быть?Инсульт: быть иль не быть?
Инсульт: быть иль не быть?
 
Case presentation to salzburg seminar of Samigulina G.R.
Case presentation to salzburg seminar of Samigulina G.R.Case presentation to salzburg seminar of Samigulina G.R.
Case presentation to salzburg seminar of Samigulina G.R.
 
Fable Revisted- Quest Generation using POP
Fable Revisted- Quest Generation using POPFable Revisted- Quest Generation using POP
Fable Revisted- Quest Generation using POP
 
Past simple
Past simplePast simple
Past simple
 
các bài toán hình học lớp 9 có lời giải
các bài toán hình học lớp 9 có lời giảicác bài toán hình học lớp 9 có lời giải
các bài toán hình học lớp 9 có lời giải
 

Similar to Visual.1 (20)

Guia n2 tam 2009 1
Guia n2 tam 2009 1Guia n2 tam 2009 1
Guia n2 tam 2009 1
 
Guía nº 8 arreglos
Guía nº 8 arreglosGuía nº 8 arreglos
Guía nº 8 arreglos
 
3152
31523152
3152
 
Exposicion iac
Exposicion iacExposicion iac
Exposicion iac
 
Guia de Laboratorios 4 - VB.NET 2005
Guia de Laboratorios 4 - VB.NET 2005Guia de Laboratorios 4 - VB.NET 2005
Guia de Laboratorios 4 - VB.NET 2005
 
Separata java script
Separata java scriptSeparata java script
Separata java script
 
Formulario de altas
Formulario de altasFormulario de altas
Formulario de altas
 
Codigo tarea deposito
Codigo tarea depositoCodigo tarea deposito
Codigo tarea deposito
 
Codigo tarea deposito
Codigo tarea depositoCodigo tarea deposito
Codigo tarea deposito
 
Guia no3 ado.net
Guia no3 ado.netGuia no3 ado.net
Guia no3 ado.net
 
Guia no3 ado.net
Guia no3 ado.netGuia no3 ado.net
Guia no3 ado.net
 
Dfd
DfdDfd
Dfd
 
MANUAL 6
MANUAL 6MANUAL 6
MANUAL 6
 
Diagramas de flujo
Diagramas de flujo Diagramas de flujo
Diagramas de flujo
 
Diagramas de flujo1
Diagramas de flujo1Diagramas de flujo1
Diagramas de flujo1
 
Diagramas de flujo
Diagramas de flujoDiagramas de flujo
Diagramas de flujo
 
Manual de DFD_3
Manual de DFD_3Manual de DFD_3
Manual de DFD_3
 
Manual de dfd
Manual de dfd Manual de dfd
Manual de dfd
 
Diagramas de flujo
Diagramas de flujoDiagramas de flujo
Diagramas de flujo
 
Manual de dfd
Manual de dfdManual de dfd
Manual de dfd
 

Visual.1

  • 1. Hola, tengo un problema. Estoy haciendo un mantenimiento en capas usando visual studio 2008 y sql server 2008. Tengo un formulario llamado mantEmpleados (mantenimiento de empleados), textboxs para ingresar / mostrar datos y botones para ingresar un "Nuevo" registro, "Grabar", etc. He creado un procedimiento en SQL Server el cual va a generar un codigo creciente a partir del ultimo numero en el campo CodEmp (codigo empleado), es decir: si encuentra el ultimo EMP001, el procedimiento generara el siguiente que seria EMP002. Hasta ahi todo va normal. El problema se presenta cuando paso a las capas, primero pongo la funcion en la capa DATOS, luego paso a NEGOCIO y al final cuando deseo que al hacer click en el boton "NUEVO" se muestre unicamente el codigo nuevo que ha generado, no muestra nada y queda en blanco. Cabe decir que para borrar todo estoy usando un for each control txtbox. Recalco que al momento de hacer click en NUEVO quiero que se cargue el codigo generado en el "tbcodigo.text" Les pongo el codigo tanto del sql como del vb y agradezco desde ya su ayuda. Script de SQL: use TomyShop go Create Proc ListarEmpleados as select * from Empleados go Create Proc GrabarEmpleados @Nombres nvarchar(100), @Cargo nvarchar(50), @Planilla nvarchar(2), @Direccion nvarchar(100), @Pais nvarchar(60), @Ciudad nvarchar(60), @Dni int,
  • 2. @Telefono nvarchar(20), @Celular nvarchar(20), @Email nvarchar(100), @Sexo nvarchar(9), @FIngreso date, @FSalida date, @Nhijos int, @FNacimiento date, @Edad int, @Sueldo decimal(6,2), @Imagen image as declare @CodEmp nvarchar(7) set @CodEmp=(select 'EMP'+ right('000'+ltrim(right(MAX(CodEmp),2)+1),3) from Empleados) insert into Empleados values(@CodEmp,@Nombres,@Cargo,@Planilla,@Direccion,@Pais,@Ciudad,@Dni,@Telefono,@Celular,@Email,@Sexo,@FIngreso,@FSalida,@Nhijos,@F Nacimiento,@Edad,@Sueldo,@Imagen) go exec grabarempleados 'Andres Lopez Casereso','Ayudante','SI','Jr. Polacal 312','Perú','Lima',41657464,'3224986','924589403','andrelope@gmail.com','Masculino','01/02/2004','',1,'10/01/1982',30,1600.00,'' go Create Proc GenerarCodEmp as select 'EMP'+ right('000'+ltrim(right (MAX(CodEmp),2)+1),3) from Empleados go Capa DATOS: classdatos.vb Imports System.Data.SqlClient Imports Microsoft.ApplicationBlocks.Data Imports Entidad Public Class classdatos Dim cn As New SqlConnection("Server=.; Integrated security=sspi; database=TomyShop") Public Function generarcodemp() As String Return SqlHelper.ExecuteNonQuery(cn, "generarcodemp")
  • 3. End Function Public Function listarempleados() As DataTable Return SqlHelper.ExecuteDataTable(cn, "listarempleados") End Function Public Function grabarempleados(ByVal ent As classentidad) As Integer Return SqlHelper.ExecuteNonQuery(cn, "grabarempleados", ent.Nombres, ent.Cargo, ent.Planilla, ent.Direccion, ent.Pais, ent.Ciudad, ent.Dni, ent.Telefono, ent.Celular, ent.Email, ent.Sexo, ent.FIngreso, ent.FSalida, ent.Nhijos, ent.FNacimiento, ent.Edad, ent.Sueldo, ent.Imagen) End Function End Class Capa ENTIDAD: classentidad.vb Public Class classentidad Public CodEmp, Nombres, Cargo, Planilla, Direccion, Pais, Ciudad, Telefono, Celular, Email, Sexo As String Public Dni, Nhijos, Edad As Integer Public Sueldo As Decimal Public FIngreso, FSalida, FNacimiento As Date Public Imagen() As Byte End Class Capa NEGOCIO: classentidad.vb Imports Entidad Imports Datos Public Class classnegocio Dim datos As New classdatos Public Function generarcodemp() As String Return datos.generarcodemp End Function Public Function listarempleados() As DataTable
  • 4. Return datos.listarempleados End Function Public Function grabarempleados(ByVal ent As classentidad) As Integer Return datos.grabarempleados(ent) End Function End Class Capa APLICACION: mantEmpleados.vb Imports Negocio Imports Entidad Imports System.IO Public Class mantEmpledos Dim NEG As New classnegocio Dim ENT As New classentidad Private Sub mantEmpledos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dgvempleados.DataSource = NEG.listarempleados End Sub Private Sub dgvempleados_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvempleados.CellClick btnmodificar.Enabled = True btneliminar.Enabled = True Try tbcodigo.Text = Me.dgvempleados.Item(0, e.RowIndex).Value tbnombres.Text = Me.dgvempleados.Item(1, e.RowIndex).Value cbocargo.Text = Me.dgvempleados.Item(2, e.RowIndex).Value cboplanilla.Text = Me.dgvempleados.Item(3, e.RowIndex).Value tbdireccion.Text = Me.dgvempleados.Item(4, e.RowIndex).Value cbopais.Text = Me.dgvempleados.Item(5, e.RowIndex).Value cbociudad.Text = Me.dgvempleados.Item(6, e.RowIndex).Value tbdni.Text = Me.dgvempleados.Item(7, e.RowIndex).Value tbtelefono.Text = Me.dgvempleados.Item(8, e.RowIndex).Value
  • 5. tbcelular.Text = Me.dgvempleados.Item(9, e.RowIndex).Value tbemail.Text = Me.dgvempleados.Item(10, e.RowIndex).Value cbosexo.Text = Me.dgvempleados.Item(11, e.RowIndex).Value dtpfingreso.Text = Me.dgvempleados.Item(12, e.RowIndex).Value dtpfsalida.Text = Me.dgvempleados.Item(13, e.RowIndex).Value tbnhijos.Text = Me.dgvempleados.Item(14, e.RowIndex).Value dtpfnacimiento.Text = Me.dgvempleados.Item(15, e.RowIndex).Value tbedad.Text = Me.dgvempleados.Item(16, e.RowIndex).Value tbsueldo.Text = Me.dgvempleados.Item(17, e.RowIndex).Value Dim MyPhoto() As Byte = CType(Me.dgvempleados.Item(18, e.RowIndex).Value, Byte()) Dim ms As New MemoryStream(MyPhoto) Me.pbimagen.Image = Image.FromStream(ms) Catch ex As Exception End Try End Sub Private Sub btngrabar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btngrabar.Click Dim ms As New MemoryStream pbimagen.Image.Save(ms, pbimagen.Image.RawFormat) ENT.CodEmp = tbcodigo.Text ENT.Nombres = tbnombres.Text ENT.Cargo = cbocargo.Text ENT.Planilla = cboplanilla.Text ENT.Direccion = tbdireccion.Text ENT.Pais = cbopais.Text ENT.Ciudad = cbociudad.Text ENT.Dni = tbdni.Text ENT.Telefono = tbtelefono.Text ENT.Celular = tbcelular.Text ENT.Email = tbemail.Text ENT.Sexo = cbosexo.Text ENT.FIngreso = dtpfingreso.Text ENT.FSalida = dtpfsalida.Text ENT.Nhijos = tbnhijos.Text
  • 6. ENT.FNacimiento = dtpfnacimiento.Text ENT.Edad = tbedad.Text ENT.Sueldo = tbsueldo.Text ENT.Imagen = ms.GetBuffer NEG.grabarempleados(ENT) MsgBox("Registro Grabado") dgvempleados.DataSource = NEG.listarempleados End Sub Private Sub btnmodificar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnmodificar.Click End Sub Private Sub btneliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btneliminar.Click End Sub Private Sub btnsalir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsalir.Click Me.Close() End Sub Private Sub btnexaminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexaminar.Click With OpenFileDialog1 .InitialDirectory = "" .FileName = "Todos los Archivos" .Filter = "Todos los Archivos |*.*|JPEGs|*.jpg|GIFs|*.gif|Bitmaps|*bmp|PNGs|*.png" .FilterIndex = 2 End With If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then pbimagen.Image = Image.FromFile(OpenFileDialog1.FileName) End If End Sub Private Sub btnnuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnuevo.Click
  • 7. Dim limpiar As Control : For Each limpiar In Me.Controls : If (TypeOf limpiar Is TextBox) OrElse (TypeOf limpiar Is ComboBox) OrElse (TypeOf limpiar Is DateTimePicker) Then limpiar.Text = "" : Next pbimagen.Image = Nothing btnmodificar.Enabled = False btneliminar.Enabled = False tbcodigo.Text = ENT.CodEmp NEG.generarcodemp() End Sub End Class