Académique Documents
Professionnel Documents
Culture Documents
V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 01
OBJETIVOS:
Reconocimiento del IDE (Entorno de Desarrollo Integrado) de Visual Basic .Net
2008
Creacin de aplicaciones Windows.
Creacin de formularios y uso de Caja de Herramientas, Explorador de Soluciones,
etc.
1.1. INGRESAR A MICROSOFT VISUAL BASIC .NET:
Debe hacer clic en el botn Inicio, luego en Programas, luego Microsoft Visual Studio
2008, luego Microsoft Visual Studio 2008, luego al ingresar nos visualizar la siguiente
ventana:
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
1.4.
PRIMERA APLICACIN.
OBJETO
Form1
Label1
Label2
PictureBox
Button1
Button2
PROPIEDAD
Name
Text
BackgroundImage
Icon
MaximizeBox
MinimizeBox
StartPosition
Text
Font
BackColor
ForeColor
TextAlign
Text
Font
BackColor
ForeColor
TextAlign
Image
SizeMode
Name
Text
Name
Text
VALOR ASIGNADO
FrmBienvenida
Bienvenidos a VB 2008
Seleccione una imagen que Ud. desee
Haga clic en y busque el archivo *.ico que desee
False
False
CenterScreen (Centrado en la pantalla)
Desarrollo de Aplicaciones .NET para Windows
Arial, Estilo Negrita cursiva, tamao 18
Transparent (Elija desde la ficha Web)
Blue (Azul)
MiddleCenter
Visual Basic 2008
Arial, Estilo negrita, tamao: 26
Transparent
Red (Rojo)
MiddleCenter
Haga clic en y busque el archivo *.jpg que desee
StretchImage / CenterImage / Normal / AutoSize
btnContinuar
&Continuar
btnSalir
&Salir
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Parmetros
Manejador de Eventos
Nota: Antes de ejecutar la aplicacin tenga en cuenta que todava no agregado el formulario
FrmDatos, as que le va a mostrar un mensaje de error en el procedimiento
btnContinuar_Click. Cul es la Solucin?
e) Seguidamente ejecute la aplicacin, para ello pulse la tecla F5 haga clic en el botn
de la barra deherramientas.
Si ocurre algn error revise el cdigo y/o corrjalo depurar.
f) Ahora proceda a guardar el proyecto, para ello haga clic en el botn Guardar todo de la
Barra deHerramientas.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
1.5.
a) Haga clic en el men Proyecto, luego clic en la opcin Agregar Windows Forms
b) Se presenta una ventana, seleccione el cono Windows Forms, luego en el cuadro
Nombres escriba: FrmDatos.vb (que viene a ser el nombre del archivo a crearse)
c) Luego haga clic en Agregar.
d) Cuando se presente el formulario proceda a disear el siguiente formulario:
Label1
Label2
Label3
Label4
Label5
TextBox1
TextBox2
TextBox3
TextBox4
TextBox5
Button1
Button2
Button3
PROPIEDAD
Name
Text
BackgroundImage
Icon
StartPosition
Text
Text
Text
Text
Text
Name
Name
Name
Name
Name
Name
Text
Image
ImageAlign
TextAlign
Name
Text
Image
ImageAlign
TextAlign
Name
Text
VALOR ASIGNADO
FrmDatos
Datos del Empelado
Seleccione una imagen que Ud. desee
Haga clic en y busque el icono de su preferencia
CenterScreen (Centrado en la pantalla)
Cdigo :
Apellidos :
Nombres :
Direccin :
Telfono :
txtCodigo
txtApellido
txtNombre
txtDireccion
txtTelefono
btnContinuar
&Continuar
Haga clic en y busque el grafico de su preferencia
TopCenter
BottomCenter
btnNuevo
&Nuevo
Haga clic en y busque el grafico de su preferencia
TopCenter
BottomCenter
btnSalir
&Salir
Docente: IngHenry, VARGAS CANCINO
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Image
ImageAlign
TextAlign
f)
As
System.Object,
ByVal
As
As
System.Object,
ByVal
As
ByVal
' Nombre_de_Objeto.Propiedad=Valor_Asignado
txtCodigo.Text = ""
txtApellidos.Text = ""
txtNombres.Text = ""
' Nombre_de_Objeto.Mtodo
txtDireccion.Clear()
txtTelefono.Clear()
txtCodigo.Focus()
End Sub
Private
Sub
BtnSalir_Click(ByVal
sender
AsSystem.EventArgs) Handles BtnSalir.Click
As
System.Object,
End
' Qu diferencia existe entre Me.Close y END
End Sub
g) Ahora proceda a guardar el proyecto, para ello haga clic en el botn Guardartodo de la
Barra de Herramientas.
h) Seguidamente ejecute la aplicacin, para ello pulse la tecla F5 haga clic en el botn
de la barra de herramientas.
1.6.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
e) Ahora procedemos a establecer las propiedades a los objetos:
OBJETO
PROPIEDAD
VALOR ASIGNADO
Name
FrmSalario
Text
Datos del Empelado
BackgroundImage
Seleccione una imagen que Ud. desee
Form3
Icon
Haga clic en y busque el icono de su preferencia
StartPosition
CenterScreen (Centrado en la pantalla)
Label1
Text
Apellidos y Nombres:
Label2
Text
Num. Horas Trabajadas:
Label3
Text
Pago x Horas:
Label4
Text
Salario Bruto:
Label5
Text
Descuentos:
Label6
Text
Salario Neto:
TextBox1
Name
txtApeNombres
txtNroHoras
TextBox2
Name
txtPagoxHoras
TextBox3
Name
txtSalarioBruto
TextBox4
Name
txtDescuento
TextBox5
Name
txtSalarioNeto
TextBox6
Name
Name
btnContinuar
Text
&Continuar
Image
Button1
Haga clic en y busque el grafico de su preferencia
ImageAlign
TopCenter
TextAlign
BottomCenter
Name
btnNuevo
Text
&Nuevo
Image
Button2
Haga clic en y busque el grafico de su preferencia
ImageAlign
TopCenter
TextAlign
BottomCenter
Name
btnSalir
Text
&Salir
Image
Button3
Haga clic en y busque el grafico de su preferencia
ImageAlign
TopCenter
TextAlign
BottomCenter
f) Ahora proceda a escribir el cdigo correspondientes:
Private Sub frmSalario_Load(ByVal sender
System.EventArgs)Handles MyBase.Load
As
System.Object,
ByVal
As
txtApeNombres.ReadOnly = True
End Sub
Private
Sub
btnCalcular_Click(ByVal
sender
AsSystem.EventArgs) Handles btnCalcular.Click
As
System.Object,
ByVal
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Private
Sub
btnLimpiar_Click(ByVal
sender
AsSystem.EventArgs) Handles btnLimpiar.Click
As
System.Object,
ByVal
As
System.Object,
ByVal
' Ustede deber hacer que regrese al formulario anterior, es decir volver a frmDatos
End Sub
Private Sub btnSalir_Click(ByVal sender
System.EventArgs)Handles btnSalir.Click
As
System.Object,
ByVal
As
Me.Close()
End Sub
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 02
OBJETIVOS:
Creacin
de
aplicaciones
Windows
con
mltiples
formularios
(MDI
MultipleDocument Interface).
2.1.
c) Cambiar las
Formularios:
OBJETO
Form1
Form2
siguientes
PROPIEDAD
Name
Text
ShowIcon
StartPosition
IsMdiContainer
Name
Text
Icon
propiedades
en
los
VALOR ASIGNADO
Form1
Formulario Principal
False
CenterPosition
True
Form2
Registro de Empleados
Haga clic en y busque el icono de su preferencia
d) En el Cuadro de
Herramientas
seleccionar la
herramienta
MenuStrip
,
lo arrastramos
hacia
el
Formulario
Principal,
procedemos a
crear la Barra
de Menus.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
f)
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 03
OBJETIVOS:
Utilizar los Objeto Cuadro de Lista y Check en Formularios.
Utilizacin de la Funcin IF / IIF (Control de Flujo).
3.1.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
OBJETO
Form1
TextBox1
TextBox2
TextBox3
TextBox4
Button1
Button2
Button3
CheckBox1
ListBox1
ListBox2
ListBox3
ListBox4
PROPIEDAD
Name
Text
StartPosition
Name
Name
Name
Name
Name
Text
Image
ImageAlign
TextAlign
Name
Text
Image
ImageAlign
TextAlign
Name
Text
Image
ImageAlign
TextAlign
Name
Text
Name
Enable
Name
Enable
Name
Enable
Name
Enable
VALOR ASIGNADO
FrmRegistro
Registro de Usuarios
CenterPosition
txtNomape
txtEdad
txtTelefono
txtTotal
btnAgregar
&Agregar
Haga clic en y busque el grafico de su preferencia
TopCenter
BottomCenter
btnQuitar
&Quitar
Haga clic en y busque el grafico de su preferencia
TopCenter
BottomCenter
btnCerrar
&Cerrar
Haga clic en y busque el grafico de su preferencia
TopCenter
BottomCenter
chkEstado
Casado
ListBox1
True
ListBox2
False
ListBox3
False
ListBox4
False
As
System.Object,
ByVal
As
Me.ListBox1.Items.Add(Me.txtNomape.Text)
Me.ListBox2.Items.Add(txtEdad.Text)
Me.ListBox3.Items.Add(Me.txtTelefono.Text)
Me.ListBox4.Items.Add(IIf(Me.chkEstado.Checked, "Casado", "Soltero"))
'Cuenta el numero de ingreso a la lista
Me.txtTotal.Text = Me.ListBox1.Items.Count
End Sub
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Private Sub btnQuitar_Click(ByVal sender
System.EventArgs) Handles btnQuitar.Click
As
System.Object,
ByVal
As
Dim i As Integer
i = Me.ListBox1.SelectedIndex()
Me.ListBox1.Items.RemoveAt(i)
Me.ListBox2.Items.RemoveAt(i)
Me.ListBox3.Items.RemoveAt(i)
Me.ListBox4.Items.RemoveAt(i)
'Cuenta el numero de ingreso a la lista
Me.txtTotal.Text = Me.ListBox1.Items.Count
End Sub
Quitar
Cdigo
If Me.txtNomape.Text = "" Then
MsgBox("Ingresar EL Nombre y y Apellidos del Usuario")
Me.txtNomape.Focus()
Else
If Me.txtEdad.Text = "" Then
MsgBox("Ingrese la Edad del Usuario")
Me.txtEdad.Focus()
Else
If Me.txtTelefono.Text = "" Then
MsgBox("Ingrese el Nmero Telefnico del Usuario")
Else
Me.ListBox1.Items.Add(Me.txtNomape.Text)
Me.ListBox2.Items.Add(txtEdad.Text)
Me.ListBox3.Items.Add(Me.txtTelefono.Text)
Me.ListBox4.Items.Add(IIf(Me.chkEstado.Checked, "Casado", "Soltero"))
'Cuenta el numero usuarios registrados en la lista
Me.txtTotal.Text = Me.ListBox1.Items.Count
'Limpia Cuadros de Texto
Me.txtNomape.Text = ""
Me.txtEdad.Text = ""
Me.txtTelefono.Text = ""
Me.chkEstado.Checked = False
'Focaliza el Objeto
Me.txtNomape.Focus()
End If
End If
End If
If Me.ListBox1.Items.Count = 0 Then
MsgBox("La lista esta vacia.....")
Docente: IngHenry, VARGAS CANCINO
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Else
Dim i As Integer
i = Me.ListBox1.SelectedIndex()
Me.ListBox1.Items.RemoveAt(i)
Me.ListBox2.Items.RemoveAt(i)
Me.ListBox3.Items.RemoveAt(i)
Me.ListBox4.Items.RemoveAt(i)
'Cuenta el numero de ingreso a la lista
Me.txtTotal.Text = Me.ListBox1.Items.Count
End If
i)
j)
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 04
OBJETIVOS:
Crear Formulario Inicio de SESION.
Invocar formulario.
4.1.
Cancelar
Cdigo
If Me.txtUsuario.Text = "admin" And Me.txtContrasena.Text = "123456" Then
MsgBox("Usuario valido")
Form2.Show()
Me.Hide()
Else
MessageBox("Usuario y/o Contrasea incorrectas")
End If
Me.txtContrasena.Clear()
Me.txtUsuario.Clear()
Dim cancel As Boolean
Dim rpt As Integer
Dim StrSalida As String
Dim StrTitulo As String
StrSalida = "Desea salir del Sistema"
StrTitulo = "Importante"
rpt = MsgBox(StrSalida, MsgBoxStyle.YesNo, StrTitulo)
If rpt = MsgBoxResult.No Then
cancel = True
Else
End
End If
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 05
OBJETIVOS:
Instalar y configurar la referencia de MySQL en VB.NET (mysql-connector-net-5.x.x)
Crear Base de datos en SGBD - MySQL.
Realizar configuracin del origen de datos - ODBC MySQL con Visual Basic.Net
Establecer conexin con MySQL y VB.NET 2008.
A. SISTEMA DE GESTIN DE BASE DE DATOS
5.1. Crear las siguientes tablas en en MySQL en la Base de Datos Prueba
CREATE TABLE `categoria` (
`codcat` int(11) NOT NULL auto_increment,
`descat` varchar(80) NOT NULL,
PRIMARY KEY (`codcat`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `productos` (
`codpro` int(11) NOT NULL auto_increment,
`nompro` varchar(80) NOT NULL,
`prepro` varchar(10) NOT NULL,
`undpro` tinyint(4) NOT NULL default '0',
`codcat` int(11) NOT NULL,
PRIMARY KEY (`codpro`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Objeto
btnConexion
Codigo
Invoca a la librera MySQL
Imports MySql.Data.MySqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnconexion.Click
Dim conexion As New MySqlConnection("data source=localhost;user
id=root;password=admin")
Try
conexion.Open()
MsgBox("Conexion establecida", MsgBoxStyle.Information, "Conectado")
Catch ex As Exception
MsgBox("No conectado", MsgBoxStyle.Critical, "No Conectado")
End Try
End Sub
End Class
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
OBJETO
Form1
TextBox1
TextBox2
TextBox3
Button1
Label1
Label2
Label3
PictureBox1
Objeto
btnConexion
PROPIEDAD
Name
Text
StartPosition
Name
Name
Name
PasswordChar
Name
Text
Name
Text
Name
Text
Name
Text
Image
SizeMode
VALOR ASIGNADO
FrmConexion
Conexin al Servidor
CenterPosition
txtServer
txtUsuario
txtPassword
#
btnConexion
&Conexin
lblServidor
Servidor
lblUsuario
Usuario
lblPassword
Contrasea
Haga clic en y busque el archivo *.jpg que desee
StretchImage / CenterImage / Normal / AutoSize
Codigo
Importando librera de MySQL
Imports MySql.Data.MySqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnconexion.Click
Dim conexion As MySqlConnection
Try
conexion = New MySqlConnection()
conexion.ConnectionString = "server=" & txtServer.Text & ";" & "user id="
& txtUsuario.Text & ";" & "password=" & txtPassword.Text & ";"
conexion.Open()
MessageBox.Show("Conectado al servidor")
Catch ex As MySqlException
MessageBox.Show("No se ha podido conectar al servidor")
End Try
End Sub
End Class
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 06
OBJETIVOS:
Establecer conexin con MySQL y Visual Basic.Net 2008.
Validacin de Usuarios.
Utilizar los Objeto PictureBox, ProgressBar y Timer.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
OBJETO
Form1
Form2
TextBox1
TextBox2
Button1
Button2
Label1
Label2
PictureBox1
PictureBox2
ProgressBar1
Timer1
PROPIEDAD
Name
Text
StartPosition
ShowIcon
Maximizebox
Minimizebox
Controlbox
AutoSize
StartPosition
Name
Text
ShowIcon
WindowState
IsMdiContainer
Name
Name
PasswordChar
Name
Text
Name
Text
Name
Text
Name
Text
Image
SizeMode
Image
SizeMode
Name
Interval
VALOR ASIGNADO
frmLogin
Validacin de Usuarios
CenterPosition
False
False
False
False
GrowAndShrink
CenterScreen
frmventas
Sistemas de Ventas - @HvcVargas 2013
False
Maximized
True
txtUsuario
txtPassword
@
btnAceptar
&Aceptar
btnSalir
&Salir
lblUsuario
Usuario
lblPassword
Password
Haga clic en y busque el archivo *.jpg que desee
StretchImage / CenterImage / Normal / AutoSize
Haga clic en y busque el archivo *.jpg que desee
StretchImage / CenterImage / Normal / AutoSize
BarraProgreso
100 (Milisegundos) / 1000 (Segundos)
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
MySqlConnectionString= Server=myServer; &_
Databse=myDatabase; &_
Uid=myUserID; &_
Pwd=myPassword; &_
Connect Timeout=30; &_
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Objeto
btnAceptar
btnSalir
Codigo
'Innvocar a la libreria MySql
Imports MySql.Data.MySqlClient
Public Class frmlogin
Private Sub btnAceptar_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnAceptar.Click
'Variables de conexion
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cn.ConnectionString = "server=localhost;uid=root;
password=admin; database=dbventas"
cmd.Connection = cn
'ProgressBar1.Value = Indica el valor de la Barra de
Progreso
'ProgressBar1.Maximum = Indica el valor maximo de la
Barra de Progreso
'ProgressBar1.Manimum = Indica el valor minimo de la
Barra de Progreso
BarraProgreso.Value = 20
'Abrimos la conexin y comprobamos que no hay error
cn.Open()
cmd.CommandText = "Select nomusu,pasusu from
musuario where nomusu='" & txtUsuario.Text & "' and
pasusu='" & txtPassword.Text & "' "
dr = cmd.ExecuteReader
If dr.HasRows Then
BarraProgreso.Value = 100
'Muestra Imagen
pbLogin2.Visible = True
'Oculta Imagen
pbLogin1.Visible = False
Console.Beep()
MessageBox.Show("Felicidades Ingres al
Systema", "Usuario " & txtUsuario.Text,
MessageBoxButtons.OK, MessageBoxIcon.None)
frmventas.Show()
Me.Visible = False
Else
pbLogin2.Visible = False
pbLogin1.Visible = True
MessageBox.Show("No se encontr el USUARIO y/o
PASSWORD", "Verifique", MessageBoxButtons.OK,
MessageBoxIcon.Error)
'Limpia controles
txtUsuario.Text = "" : txtPassword.Text = ""
BarraProgreso.Value = 0
'Focaliza el control txtUsuario
txtUsuario.Focus()
End If
End Sub
End Class
Private Sub btnSalir_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSalir.Click
Docente: IngHenry, VARGAS CANCINO
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
If MsgBox("Desea salir de la aplicacin?",
MsgBoxStyle.OkCancel + MsgBoxStyle.Information,
"Advertencia!!") = MsgBoxResult.Ok Then
End
Else
txtUsuario.Text = "" : txtPassword.Text = ""
'Focaliza el control txtUsuario
txtUsuario.Focus()
End If
End Sub
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Opcin
Calculadora
Codigo
Private Sub CalculadoraToolStripMenuItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
CalculadoraToolStripMenuItem.Click
Shell("explorer.exe
root=c:\windows\system32\calc.exe", vbNormalFocus)
End Sub
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
As System.Object, ByVal e As System.EventArgs) Handles
CalculadoraToolStripMenuItem.Click
Shell("calc.exe", AppWinStyle.NormalFocus)
End Sub
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 07
OBJETIVOS:
Establecer conexin con MySQL y Visual Basic.Net 2008.
Agregar, Modificar y Eliminar registros.
Mostrar registros de una tabla de mysql.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
OBJETO
Form1
TextBox1
TextBox2
TextBox3
TextBox4
TextBox5
Button1
Button2
Button3
Label1
ListView
PROPIEDAD
Name
Text
StartPosition
Maximizebox
Minimizebox
Controlbox
AutoSize
StartPosition
Name
Name
Name
Name
Name
Name
Text
Name
Text
Name
Text
Text
Name
View
VALOR ASIGNADO
frmCliente
Mantenimiento de Clientes
CenterPosition
False
False
False
GrowAndShrink
CenterScreen
txtCodigo
txtNombre
txtApellidos
txtFna
txtDireccion
btnAgregar
Agregar
btnEditar
Editar
btnEliminar
Eliminar
CLIENTES
Lvdisplay
Details(Detalle)
Docente: IngHenry, VARGAS CANCINO
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
7.3.
7.4.
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Codigo
Imports MySql.Data.MySqlClient
Imports System.Data
Public Class frmcliente
Dim ds As DataSet
Dim sqlcon As MySqlConnection
Dim da As MySqlDataAdapter
FORMULARIO
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
sqlcon = New MySqlConnection("server=localhost; database=dbdemo; uid=root;
pwd=123")
sqlcon.Open()
If sqlcon.State = ConnectionState.Open Then
MsgBox("Conexin Ok")
Call showData()
Else
MsgBox("Conexin Error!!!")
End If
End Sub
BOTON AGREGAR
Private Sub btnAgregar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAgregar.Click
ds = New DataSet
da = New MySqlDataAdapter("insert into
mcliente(codcli,nomcli,apecli,dircli,fnacli) values('" & txtCodigo.Text &
"','" & txtNombre.Text & "','" & txtApellidos.Text & "','" &
txtDireccion.Text & "','" & txtFnacli.Text & "')", sqlcon)
da.Fill(ds, "mcliente")
Call showData()
End Sub
BOTON EDITAR
Private Sub BtnEditar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnEditar.Click
ds = New DataSet
da = New MySqlDataAdapter("update mcliente set nomcli='" & txtNombre.Text &
"',apecli='" & txtApellidos.Text & "',dircli='" & txtDireccion.Text &
"',fnacli='" & txtFnacli.Text & "') where codcli='" & txtCodigo.Text & "'",
sqlcon)
da.Fill(ds, "mcliente")
Call showData()
End Sub
BOTON ELIMINAR
Private Sub BtnEliminar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnEliminar.Click
ds = New DataSet
da = New MySqlDataAdapter("delete from mcliente where codcli='" &
txtCodigo.Text & "'", sqlcon)
da.Fill(ds, "mcliente")
Call showData()
End Sub
Docente: IngHenry, VARGAS CANCINO
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
End With
Next
End If
txtCodigo.Text = ""
txtNombre.Text = ""
txtApellidos.Text = ""
txtDireccion.Text = ""
txtFnacli.Text = ""
End Sub
Private Sub lvDisplay_click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lvdisplay.Click
txtCodigo.Text = lvdisplay.SelectedItems(0).Text
txtNombre.Text = lvdisplay.SelectedItems(0).SubItems(1).Text
txtApellidos.Text = lvdisplay.SelectedItems(0).SubItems(2).Text
txtDireccion.Text = lvdisplay.SelectedItems(0).SubItems(3).Text
txtFnacli.Text = lvdisplay.SelectedItems(0).SubItems(4).Text
End Sub
End Class
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
GUA DE LABORATORIO N 08
OBJETIVOS:
Creacin de reportes con CrystalReport.
Manejo del componente CrystalReportViewer
U.A.N.C.V - PUNO
Desarrollo de Software
F.I.S
-
Asignatura
Luego nos visualizar una ventana [Agregar nuevo elemento], usted deber
seleccionar Crystal Reports.
Luego escriba el nombre del reporte: rptRepClientes.rpt
Por ltimo haga clic en el botn Agregar, luego ste reporte se habr agregado
al Explorador de soluciones.
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
En ella deber seleccionar el orgen de datos, para nuestro caso ser ODBC, y el
Proveedor a elegir es MySQL ODBC 3.5.1 Drivers, luego deber hacer clic en el
botn siguiente, tal como se muestra en la figura siguiente:
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Ahora haga clic en [>] (Uno campo a la vez) [>>] (Todos los campos)
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Panel 1
Propiedad:
Dock= Left
Panel 2
Propiedad:
Dock= Top
Panel 3
Propiedad:
Dock= Fill
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
8.7. Proceda a establecer las propiedades a cada uno de los objetos segn el siguiente
cuadro. Adems deber establecer otras propiedades para mejorar la apariencia
de nuestro formulario.
Objeto
Propiedad
Valor Asignado
Label1
Dock
Fill
TextAlign
MiddleCenter
Text
Seleccione una Opcin
RadioButton1
Name
rbtClientes
Button1
Name
btnEjecutar
Text
Cargar Reporte
Button2
Name
btnImpresora
Text
Seleccionar Impresora
CrystalReportViewer1
DisplayGroupTree
False
Dock
Fill
ShowGroupTreeButton
False
U.A.N.C.V - PUNO
F.I.S
Asignatura
Desarrollo de Software
U.A.N.C.V - PUNO
Asignatura
Desarrollo de Software
F.I.S
Codigo
FORMULARIO frmReporte
Private Sub btnReporte_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnReporte.Click
If Me.rbtClientes.Checked = True Then
Label1.Text = "Reporte de Clientes"
Me.CRV1.ReportSource="C:\SystemVentas\SystemVentas\rptRepClientes.rpt"
End If
'La ruta de los archivos *.rpt deber ser reemplazada por la correcta,
segn cada alumno.
End Sub