SlideShare una empresa de Scribd logo
OptionExplicit
DimArchivoIMG AsString
Private Subcmd_Agregar_Click()
Dim i As Integer
If cbo_Nombre.Text="" Then
MsgBox "Nombre inválido",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
End If
If Not(Mid(cbo_Nombre.Text,1,1) Like "[a-z]"OrMid(cbo_Nombre.Text,1,1) Like "[A-Z]")
Then
MsgBox "Nombre inválido",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
End If
For i = 2 To Len(cbo_Nombre.Text)
If Mid(cbo_Nombre.Text,i,1) Like "#"Then
MsgBox "Nombre inválido",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
EndIf
Next
Sheets("Clientes").Activate
Dim fClienteAs Integer
fCliente =nCliente(cbo_Nombre.Text)
If fCliente=0 Then
Do While NotIsEmpty(ActiveCell)
ActiveCell.Offset(1,0).Activate 'si el registronoexiste,se vaal final.
Loop
Else
Cells(fCliente,1).Select 'cuando ya existe el registro,cumple estacondición.
End If
'Aqui escuando agregamoso modificamosel registro
Application.ScreenUpdating=False
ActiveCell=cbo_Nombre
ActiveCell.Offset(0,1) = txt_Direccion
ActiveCell.Offset(0,2) = txt_Telefono
ActiveCell.Offset(0,3) = txt_ID
ActiveCell.Offset(0,4) = txt_Email
ActiveCell.Offset(0,5) = ArchivoIMG
Application.ScreenUpdating=True
LimpiarFormulario
cbo_Nombre.SetFocus
End Sub
Private Subcmd_Eliminar_Click()
Dim fClienteAsInteger
fCliente =nCliente(cbo_Nombre.Text)
If fCliente=0 Then
MsgBox "El cliente que ustedquiere eliminarnoexiste",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
End If
If MsgBox("¿Seguroque quiere eliminareste cliente?",vbQuestion+vbYesNo) =vbYesThen
Cells(fCliente,1).Select
ActiveCell.EntireRow.Delete
LimpiarFormulario
MsgBox "Cliente eliminado",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
End If
End Sub
Private Subcmd_Cerrar_Click()
End
End Sub
Private Subcbo_Nombre_Change()
On Error Resume Next
If nCliente(cbo_Nombre.Text) <>0 Then
Sheets("Clientes").Activate
Cells(cbo_Nombre.ListIndex +2, 1).Select
txt_Direccion=ActiveCell.Offset(0,1)
txt_Telefono=ActiveCell.Offset(0,2)
txt_ID= ActiveCell.Offset(0,3)
txt_Email = ActiveCell.Offset(0,4)
fotografia.Picture =LoadPicture("")
fotografia.Picture =LoadPicture(ActiveCell.Offset(0,5))
ArchivoIMG= ActiveCell.Offset(0,5)
Else
txt_Direccion=""
txt_Telefono=""
txt_ID= ""
txt_Email = ""
ArchivoIMG= ""
fotografia.Picture =LoadPicture("")
End If
End Sub
Private Subcbo_Nombre_Enter()
CargarLista
End Sub
SubCargarLista()
cbo_Nombre.Clear
Sheets("Clientes").Select
Range("A2").Select
Do While NotIsEmpty(ActiveCell)
cbo_Nombre.AddItemActiveCell.Value
ActiveCell.Offset(1,0).Select
Loop
End Sub
SubLimpiarFormulario()
CargarLista
cbo_Nombre = ""
txt_Direccion= ""
txt_Telefono=""
txt_ID = ""
txt_Email = ""
ArchivoIMG= ""
End Sub
Private Subcmd_Imagen_Click()
On Error Resume Next
ArchivoIMG= Application.GetOpenFilename("Imágenesjpg,*.jpg,Imágenesbmp,*.bmp",0,
"SeleccionarImágenparaReegistrode Clientes")
fotografia.Picture =LoadPicture("")
fotografia.Picture =LoadPicture(ArchivoIMG)
End Sub

Más contenido relacionado

DOCX
Código formularios1
DOC
Formulario Para Los Vendedores
PDF
Ejemplos Borland C++ Builder
DOC
Formulario Para Agregar Cliente
PDF
Tic metodos de abreviados de un teclado (1)
PDF
Tic metodos de abreviados de un teclado (1) (1)
PDF
Retroalimentacion práctica 1.pdf
Código formularios1
Formulario Para Los Vendedores
Ejemplos Borland C++ Builder
Formulario Para Agregar Cliente
Tic metodos de abreviados de un teclado (1)
Tic metodos de abreviados de un teclado (1) (1)
Retroalimentacion práctica 1.pdf

Destacado (11)

DOCX
Credo Religioso
PPTX
Trabajo final-de-amarilis-gomez
PPS
Es men disciplina_positiva_.ppt
PPTX
Actitudes del maestro ii
PPT
Escuela padres limites y disciplina
PPT
Disciplina positiva
PPTX
Disciplina Positiva en el aula
PPT
Presentación Disciplina Positiva
PPT
Disciplina Positiva E.Infantil y Primaria
PPTX
Disciplina Positiva
PPTX
Taller sobre la disciplina positiva en el aula
Credo Religioso
Trabajo final-de-amarilis-gomez
Es men disciplina_positiva_.ppt
Actitudes del maestro ii
Escuela padres limites y disciplina
Disciplina positiva
Disciplina Positiva en el aula
Presentación Disciplina Positiva
Disciplina Positiva E.Infantil y Primaria
Disciplina Positiva
Taller sobre la disciplina positiva en el aula
Publicidad

Último (20)

PDF
ACERTIJO EL CONJURO DEL CAZAFANTASMAS MATEMÁTICO. Por JAVIER SOLIS NOYOLA
PDF
ACERTIJO Súper Círculo y la clave contra el Malvado Señor de las Formas. Por ...
PDF
2.0 Introduccion a processing, y como obtenerlo
PDF
Introducción a la historia de la filosofía
PDF
Ernst Cassirer - Antropologia Filosofica.pdf
PDF
Introduccion a la Investigacion Cualitativa FLICK Ccesa007.pdf
PDF
Mi Primer Millon - Poissant - Godefroy Ccesa007.pdf
PPTX
LAS MIGRACIONES E INVASIONES Y EL INICIO EDAD MEDIA
PDF
La Inteligencia Emocional - Fabian Goleman TE4 Ccesa007.pdf
PDF
informe tipos de Informatica perfiles profesionales _pdf
PDF
Iniciación Al Aprendizaje Basado En Proyectos ABP Ccesa007.pdf
PDF
MATERIAL DIDÁCTICO 2023 SELECCIÓN 1_REFORZAMIENTO 1° BIMESTRE_COM.pdf
PDF
Aumente su Autoestima - Lair Ribeiro Ccesa007.pdf
PDF
Telos 127 Generacion Al fa Beta - fundaciontelefonica
PPTX
Presentación de la Cetoacidosis diabetica.pptx
PDF
Teologia-Sistematica-Por-Lewis-Sperry-Chafer_060044.pdf
PPTX
MATEMATICAS GEOMETRICA USO TRANSPORTADOR
PDF
Esc. Sab. Lección 7. El pan y el agua de vida.pdf
PDF
Integrando la Inteligencia Artificial Generativa (IAG) en el Aula
PDF
TOMO II - LITERATURA.pd plusenmas ultras
ACERTIJO EL CONJURO DEL CAZAFANTASMAS MATEMÁTICO. Por JAVIER SOLIS NOYOLA
ACERTIJO Súper Círculo y la clave contra el Malvado Señor de las Formas. Por ...
2.0 Introduccion a processing, y como obtenerlo
Introducción a la historia de la filosofía
Ernst Cassirer - Antropologia Filosofica.pdf
Introduccion a la Investigacion Cualitativa FLICK Ccesa007.pdf
Mi Primer Millon - Poissant - Godefroy Ccesa007.pdf
LAS MIGRACIONES E INVASIONES Y EL INICIO EDAD MEDIA
La Inteligencia Emocional - Fabian Goleman TE4 Ccesa007.pdf
informe tipos de Informatica perfiles profesionales _pdf
Iniciación Al Aprendizaje Basado En Proyectos ABP Ccesa007.pdf
MATERIAL DIDÁCTICO 2023 SELECCIÓN 1_REFORZAMIENTO 1° BIMESTRE_COM.pdf
Aumente su Autoestima - Lair Ribeiro Ccesa007.pdf
Telos 127 Generacion Al fa Beta - fundaciontelefonica
Presentación de la Cetoacidosis diabetica.pptx
Teologia-Sistematica-Por-Lewis-Sperry-Chafer_060044.pdf
MATEMATICAS GEOMETRICA USO TRANSPORTADOR
Esc. Sab. Lección 7. El pan y el agua de vida.pdf
Integrando la Inteligencia Artificial Generativa (IAG) en el Aula
TOMO II - LITERATURA.pd plusenmas ultras
Publicidad

Option explicit

  • 1. OptionExplicit DimArchivoIMG AsString Private Subcmd_Agregar_Click() Dim i As Integer If cbo_Nombre.Text="" Then MsgBox "Nombre inválido",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub End If If Not(Mid(cbo_Nombre.Text,1,1) Like "[a-z]"OrMid(cbo_Nombre.Text,1,1) Like "[A-Z]") Then MsgBox "Nombre inválido",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub End If For i = 2 To Len(cbo_Nombre.Text) If Mid(cbo_Nombre.Text,i,1) Like "#"Then MsgBox "Nombre inválido",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub EndIf Next
  • 2. Sheets("Clientes").Activate Dim fClienteAs Integer fCliente =nCliente(cbo_Nombre.Text) If fCliente=0 Then Do While NotIsEmpty(ActiveCell) ActiveCell.Offset(1,0).Activate 'si el registronoexiste,se vaal final. Loop Else Cells(fCliente,1).Select 'cuando ya existe el registro,cumple estacondición. End If 'Aqui escuando agregamoso modificamosel registro Application.ScreenUpdating=False ActiveCell=cbo_Nombre ActiveCell.Offset(0,1) = txt_Direccion ActiveCell.Offset(0,2) = txt_Telefono ActiveCell.Offset(0,3) = txt_ID ActiveCell.Offset(0,4) = txt_Email ActiveCell.Offset(0,5) = ArchivoIMG
  • 3. Application.ScreenUpdating=True LimpiarFormulario cbo_Nombre.SetFocus End Sub Private Subcmd_Eliminar_Click() Dim fClienteAsInteger fCliente =nCliente(cbo_Nombre.Text) If fCliente=0 Then MsgBox "El cliente que ustedquiere eliminarnoexiste",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub End If If MsgBox("¿Seguroque quiere eliminareste cliente?",vbQuestion+vbYesNo) =vbYesThen Cells(fCliente,1).Select ActiveCell.EntireRow.Delete LimpiarFormulario
  • 4. MsgBox "Cliente eliminado",vbInformation+vbOKOnly cbo_Nombre.SetFocus End If End Sub Private Subcmd_Cerrar_Click() End End Sub Private Subcbo_Nombre_Change() On Error Resume Next If nCliente(cbo_Nombre.Text) <>0 Then Sheets("Clientes").Activate Cells(cbo_Nombre.ListIndex +2, 1).Select txt_Direccion=ActiveCell.Offset(0,1) txt_Telefono=ActiveCell.Offset(0,2) txt_ID= ActiveCell.Offset(0,3) txt_Email = ActiveCell.Offset(0,4) fotografia.Picture =LoadPicture("") fotografia.Picture =LoadPicture(ActiveCell.Offset(0,5))
  • 5. ArchivoIMG= ActiveCell.Offset(0,5) Else txt_Direccion="" txt_Telefono="" txt_ID= "" txt_Email = "" ArchivoIMG= "" fotografia.Picture =LoadPicture("") End If End Sub Private Subcbo_Nombre_Enter() CargarLista End Sub SubCargarLista() cbo_Nombre.Clear Sheets("Clientes").Select Range("A2").Select Do While NotIsEmpty(ActiveCell) cbo_Nombre.AddItemActiveCell.Value ActiveCell.Offset(1,0).Select Loop End Sub
  • 6. SubLimpiarFormulario() CargarLista cbo_Nombre = "" txt_Direccion= "" txt_Telefono="" txt_ID = "" txt_Email = "" ArchivoIMG= "" End Sub Private Subcmd_Imagen_Click() On Error Resume Next ArchivoIMG= Application.GetOpenFilename("Imágenesjpg,*.jpg,Imágenesbmp,*.bmp",0, "SeleccionarImágenparaReegistrode Clientes") fotografia.Picture =LoadPicture("") fotografia.Picture =LoadPicture(ArchivoIMG) End Sub