Está en la página 1de 5

Tcnicos que dominan la prctica

M. VISUAL STUDIO 2005

FORMULARIO CONTACTOS DISEO (Sencillo)

Label1, en orden hacia abajo

TextBox1, en orden hacia abajo

ListBox1, bueno aqu esta dems mencionar

Nota: Cada objeto ha sido insertado y manteniendo su nombre original, es decir Textbox1, textbox2, como los botones button1, button2, claro que en orden Siguiendo la imagen para el caso de los botones Control Button1 Button2 Button3 Button4 Propiedad Text Text Text Text Valor Agregar Modificar Eliminar Salir

Para el caso de Arreglar mas su Formulario Pueden poner un color de fondo o tambien una imagen para que se vea mas presentable y personalizado al gusto de cada uno de ustedes. BackgroundImage (Para agregar la imagen de fondo) BackgroundImageLayout (La posicion dela imagen)
Docente: Franklin Cappa Ticona Esp: Sistemas e Informtica FranklinCappa@hotmail.com cel.: 953930214/*742765

Tcnicos que dominan la prctica

M. VISUAL STUDIO 2005

PROGRAMACIN Ojo: Las lineas yo las he agregado para que se note la separacin, en visual net se agregan solas, es decir si vana copiar el codigo a visual no copien las lineas simplemente obvienlas. Public Class contactos Dim var As String = "ADD" Dim ubicar As Integer _________________________________________________________________________ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If var = "ADD" Then 'vamos agregar los valores de los textbox a los listbox 'tomamos el valor de textbox, agregamos a la lista y dejamos 'vacio el textbox, es decir limpiarlo al final ListBox1.Items.Add(TextBox1.Text) 'agrego el nombre ListBox2.Items.Add(TextBox2.Text) 'agrego el apellido ListBox3.Items.Add(TextBox3.Text) 'agrego el direccion ListBox4.Items.Add(TextBox4.Text) 'agrego el celular ListBox5.Items.Add(TextBox5.Text) 'agrego el email limpiar() End If If var = "MOD" Then ListBox1.Items.Item(ubicar) = TextBox1.Text.ToString.Trim() ListBox2.Items.Item(ubicar) = TextBox2.Text.ToString.Trim() ListBox3.Items.Item(ubicar) = TextBox3.Text.ToString.Trim() ListBox4.Items.Item(ubicar) = TextBox4.Text.ToString.Trim() ListBox5.Items.Item(ubicar) = TextBox5.Text.ToString.Trim() activar_listas() var = "ADD" End If End Sub _________________________________________________________________________ Sub limpiar() TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox1.Focus() End Sub _________________________________________________________________________ Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim indec As Integer
Docente: Franklin Cappa Ticona Esp: Sistemas e Informtica FranklinCappa@hotmail.com cel.: 953930214/*742765

Tcnicos que dominan la prctica

M. VISUAL STUDIO 2005

indec = ListBox1.SelectedIndex ubicar = indec var = "MOD" If indec = -1 Then MessageBox.Show("No hay item seleccionado") Else 'selecteditem es para tomar el valor de listbox ' el item que este seleccionado TextBox1.Text = ListBox1.Text().Trim TextBox2.Text = ListBox2.Text().Trim TextBox3.Text = ListBox3.Text().Trim TextBox4.Text = ListBox4.Text().Trim TextBox5.Text = ListBox5.Text().Trim desactivar_listas() End If End Sub _________________________________________________________________________ Sub desactivar_listas() ListBox1.Enabled = False ListBox2.Enabled = False ListBox3.Enabled = False ListBox4.Enabled = False ListBox5.Enabled = False End Sub _________________________________________________________________________ Sub activar_listas() ListBox1.Enabled = True ListBox2.Enabled = True ListBox3.Enabled = True ListBox4.Enabled = True ListBox5.Enabled = True End Sub _________________________________________________________________________ Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim index As Integer index = ListBox1.SelectedIndex If index <> -1 Then 'items.removeat me permite eliminar un item de la lista 'se le indica que numero de item borrar ListBox1.Items.RemoveAt(index) ListBox2.Items.RemoveAt(index) ListBox3.Items.RemoveAt(index)
Docente: Franklin Cappa Ticona Esp: Sistemas e Informtica FranklinCappa@hotmail.com cel.: 953930214/*742765

Tcnicos que dominan la prctica

M. VISUAL STUDIO 2005

ListBox4.Items.RemoveAt(index) ListBox5.Items.RemoveAt(index) End If End Sub _________________________________________________________________________ Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.close End Sub _________________________________________________________________________ Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Dim i As Integer i = ListBox1.SelectedIndex ListBox2.SelectedIndex = i ListBox3.SelectedIndex = i ListBox4.SelectedIndex = i ListBox5.SelectedIndex = i End Sub _________________________________________________________________________ Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged Dim i As Integer i = ListBox2.SelectedIndex ListBox1.SelectedIndex = i ListBox3.SelectedIndex = i ListBox4.SelectedIndex = i ListBox5.SelectedIndex = i End Sub _________________________________________________________________________ Private Sub ListBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox3.SelectedIndexChanged Dim i As Integer i = ListBox3.SelectedIndex ListBox1.SelectedIndex = i ListBox2.SelectedIndex = i ListBox4.SelectedIndex = i ListBox5.SelectedIndex = i End Sub _________________________________________________________________________

Docente: Franklin Cappa Ticona Esp: Sistemas e Informtica

FranklinCappa@hotmail.com cel.: 953930214/*742765

Tcnicos que dominan la prctica

M. VISUAL STUDIO 2005

Private Sub ListBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox4.SelectedIndexChanged Dim i As Integer i = ListBox4.SelectedIndex ListBox1.SelectedIndex = i ListBox2.SelectedIndex = i ListBox3.SelectedIndex = i ListBox5.SelectedIndex = i End Sub _________________________________________________________________________ Private Sub ListBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox5.SelectedIndexChanged Dim i As Integer i = ListBox5.SelectedIndex ListBox1.SelectedIndex = i ListBox2.SelectedIndex = i ListBox3.SelectedIndex = i ListBox4.SelectedIndex = i End Sub End Class

Como recien empezamos todavia no estamos viendo propiedades y funciones para validar correctamente todo, es decir preparar un formulario a prueba de todo, o como dicen otros a PRUEBA DE BOMBAS

LISTO, NADA MAS, ASI DE SENCILLO, JEJEJE

Docente: Franklin Cappa Ticona Esp: Sistemas e Informtica

FranklinCappa@hotmail.com cel.: 953930214/*742765

También podría gustarte