Академический Документы
Профессиональный Документы
Культура Документы
INTRODUCCIN
Microsoft Visual Studio es un entorno de desarrollo integrado que permite crear aplicaciones,
sitios y servicios web, el curso de Visual Basic bsico tiene como objetivo la fundamentacin
de los conceptos bsicos y la aplicacin de sus herramientas para el desarrollo de programas
computacionales.
Aprender los conceptos y principios bsicos de Visual Basic 2010 permitir al futuro ingeniero
de sistemas aplicarlos a los diferentes procesos que den solucin a problemas
computacionales.
El siguiente trabajo se realiza con el propsito de reconocer los conceptos bsicos, de
objetos, eventos, formas controles, propiedades, variables y tipos de datos as como el uso
de las herramientas y formularios con sus propiedades aplicados a la prctica.
.
OBJETIVOS
OBJETIVO GENERAL
Reconocer en Visual Basic 2010, los conceptos bsicos, de objetos, eventos, formas
controles, propiedades, variables y tipos de datos as como el uso de las herramientas y
formularios con sus propiedades aplicados a la prctica.
OBJETIVOS ESPECFICOS.
Realizar una revisin general de las temticas de la unidad uno del mdulo Visual
Basic Bsico.
Interactuar con el grupo colaborativo del curso Visual Basic Bsico.
Realizar aportes en el foro desarrollando 10 ejercicios de aplicacin en Visual Basic
2010.
DESARROLLO
1. Un programa que calcule 5 diferentes reas y volumen de figuras geomtricas
MEN INICIO Form1
Public Class Form1
Private Sub esferaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CuadradoToolStripMenuItem.Click
Form2.Show()
Me.Hide()
End Sub
Private Sub cuboToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PENTAGONOToolStripMenuItem.Click
Form3.Show()
Me.Hide()
End Sub
Private Sub prismaToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PENTAGONOToolStripMenuItem1.Click
Form4.Show()
Me.Hide()
End Sub
Private Sub cilindroToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RECTANGULOToolStripMenuItem.Click
Form5.Show()
Me.Hide()
End Sub
Private Sub conoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TRIANGULOToolStripMenuItem.Click
Form6.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Me.Hide()
End Sub
End Class
Esfera Form2
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
TextBox2.Text = 4 * (3.14) * Val(TextBox1.Text) ^ 2
TextBox3.Text = (4 / 3) * (3.14) * Val(TextBox1.Text) ^ 3
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Label3.Click
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
Cubo form3
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
TextBox2.Text = 6 * (Val(TextBox1.Text) ^ 2)
TextBox3.Text = Val(TextBox1.Text) ^ 3
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
Prisma form4
TextBox5.Text = Val(TextBox4.Text) * Val(TextBox2.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
Cilindro Form5
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
TextBox3.Text = 2 * 3.1416 * Val(TextBox1.Text) * (Val(TextBox2.Text) +
Val(TextBox1.Text))
TextBox4.Text = 3.1416 * Val(TextBox1.Text) ^ 2 * Val(TextBox2.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
Cono form6
Public Class Form6
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
TextBox3.Text = (3.1416 * Val(TextBox1.Text) ^ 2) + (3.1416 * Val(TextBox1.Text) *
Val(TextBox2.Text))
TextBox5.Text = (3.1416 * Val(TextBox1.Text) ^ 2 * Val(TextBox4.Text)) / 3
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
2. Programa que resuelva ecuacin cuadrtica (para + y - )
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim a As Double = tbA.Text
Dim b As Double = tbB.Text
Dim c As Double = tbC.Text
Dim x1 As Double
Dim x2 As Double
x1 = (-b + Math.Sqrt((b ^ 2) - 4 * a * c)) / (2 * a)
x2 = (-b - Math.Sqrt((b ^ 2) - 4 * a * c)) / (2 * a)
lbX1.Text &= x1
lbX2.Text &= x2
End Sub
End Class
3. Programa que haga conversin de medidas de longitud o volumen
Public Class Form1
Private Sub cmdconvertir_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdconvertir.Click
If entrada.Text = "Milimetros" And salida.Text = "Milimetros" Then
lblr.Text = Val(Textvalor.Text)
lblum.Text = "mm"
ElseIf entrada.Text = "Milimetros" And salida.Text = "Centimetros" Then
lblr.Text = Val(Textvalor.Text) / 10
lblum.Text = "cm"
ElseIf entrada.Text = "Milimetros" And salida.Text = "Metros" Then
lblr.Text = Val(Textvalor.Text) / 1000
lblum.Text = "m"
ElseIf entrada.Text = "Milimetros" And salida.Text = "Kilometros" Then
lblr.Text = Val(Textvalor.Text) / 1000000
lblum.Text = "km"
ElseIf entrada.Text = "Centimetros" And salida.Text = "Milimetros" Then
lblr.Text = Val(Textvalor.Text) * 10
lblum.Text = "mm"
ElseIf entrada.Text = "Centimetros" And salida.Text = "Centimetros" Then
lblr.Text = Val(Textvalor.Text)
lblum.Text = "cm"
ElseIf entrada.Text = "Centimetros" And salida.Text = "Metros" Then
lblr.Text = Val(Textvalor.Text) / 100
lblum.Text = "m"
ElseIf entrada.Text = "Centimetros" And salida.Text = "Kilometros" Then
lblr.Text = Val(Textvalor.Text) / 100000
lblum.Text = "km"
ElseIf entrada.Text = "Metros" And salida.Text = "Milimetros" Then
lblr.Text = Val(Textvalor.Text) * 1000
lblum.Text = "mm"
ElseIf entrada.Text = "Metros" And salida.Text = "Centimetros" Then
lblr.Text = Val(Textvalor.Text) * 100
lblum.Text = "cm"
ElseIf entrada.Text = "Metros" And salida.Text = "Metros" Then
lblr.Text = Val(Textvalor.Text)
lblum.Text = "m"
ElseIf entrada.Text = "Metros" And salida.Text = "Kilometros" Then
lblr.Text = Val(Textvalor.Text) / 1000
lblum.Text = "km"
ElseIf entrada.Text = "Kilometros" And salida.Text = "Milimetros" Then
lblr.Text = Val(Textvalor.Text) * 1000000
lblum.Text = "mm"
ElseIf entrada.Text = "Kilometros" And salida.Text = "Centimetros" Then
lblr.Text = Val(Textvalor.Text) * 100000
lblum.Text = "cm"
ElseIf entrada.Text = "Kilometros" And salida.Text = "Metros" Then
lblr.Text = Val(Textvalor.Text) * 1000
lblum.Text = "m"
ElseIf entrada.Text = "Kilometros" And salida.Text = "Kilometros" Then
lblr.Text = Val(Textvalor.Text)
lblum.Text = "km"
End If
End Sub
Private Sub cmdnuevo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdnuevo.Click
lblr.Text = ""
lblum.Text = ""
Textvalor.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Me.Hide()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
4. Programa que cambie en un cuadro de texto diferentes formatos de texto y tamao
Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cbFuente.SelectedIndexChanged,
cbTamano.SelectedIndexChanged
Dim fuente As String = cbFuente.Text
Dim tamao As Integer = CInt(cbTamano.Text)
texto.Font = New Font(cbFuente.Text, tamao)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class
5. Programa que encuentre el inters simple
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
'(10.000.000*0.05)*12 = 6.000.000.
Dim cInicial As Double = tbCInicial.Text
Dim periodos As Double = tbPeriodos.Text
Dim interes As Double = tbInteres.Text
Dim interesMes As Double = (cInicial * (interes / 100))
lbInteres.Text &= interesMes
lbRes.Text &= interesMes * periodos
End Sub
End Class
6. Programa que calcule Velocidad, Espacio y Tiempo
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
TextBox3.Text = ((Val(TextBox1.Text) * 1000) / Val(TextBox2.Text) * 60) / 1000
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
TextBox6.Text = (((Val(TextBox4.Text) * 1000) / 3600) * (Val(TextBox5.Text) * 60)) /
1000
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
TextBox9.Text = ((Val(TextBox7.Text) * 1000) / (Val(TextBox8.Text) * (1000 / 3600))) /
60
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button4.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button5.Click
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button6.Click
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button7.Click
Me.Hide()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Label8.Click
End Sub
End Class
7. Programa que maneje Timer
Public Class Form1
Dim a As Integer
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox2.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
a = 0
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
a = a + 1
If a = 1 Then
Button3.Visible = False
Button4.Visible = True
Button5.Visible = True
Button6.Visible = True
Button7.Visible = False
End If
If a = 4 Then
Button3.Visible = True
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
Button7.Visible = False
End If
If a = 8 Then
Button3.Visible = True
Button4.Visible = True
Button5.Visible = False
Button6.Visible = False
Button7.Visible = True
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Me.Hide()
End Sub
End Class
8. Programa que maneje listas con ListBox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btns.Click
Dim n, i, r As Integer
n = nudnumero.Value
lbtabla.Items.Clear()
For i = n To 12
r = n + i
lbtabla.Items.Add(n & "+" & i & "=" & r)
Next
End Sub
Private Sub btnr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnr.Click
Dim n, i, r As Integer
n = nudnumero.Value
lbtabla.Items.Clear()
For i = n To 12
r = n - i
lbtabla.Items.Add(n & "-" & i & "=" & r)
Next
End Sub
Private Sub btnm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnm.Click
Dim n, i, r As Integer
n = nudnumero.Value
lbtabla.Items.Clear()
For i = n To 12
r = n * i
lbtabla.Items.Add(n & "*" & i & "=" & r)
Next
End Sub
Private Sub btnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnd.Click
Dim n, i As Integer
Dim r As Single
n = nudnumero.Value
lbtabla.Items.Clear()
For i = 1 To 12
r = n / i
lbtabla.Items.Add(n & "/" & i & "=" & r.ToString("###,##0.00"))
Next
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Label1.Click
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Hide()
End Sub
End Class
9. Programa que maneje Botones de Opcin (RadioButton)
Public Class Form1
Dim n1, n2, n3, n4, nf As Single
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton3.CheckedChanged
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton5.CheckedChanged
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Enabled = True Then
n1 = 2.5
End If
If RadioButton4.Enabled = False Then
n1 = 0
End If
End Sub
Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton6.CheckedChanged
If RadioButton6.Enabled = True Then
n2 = 2.5
End If
If RadioButton6.Enabled = False Then
n2 = 0
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
nf = n1 + n2 + n3 + n4
TextBox2.Text = nf.ToString("#.0")
If nf = 10.0 Then
TextBox3.Text = "EXCELENTE"
End If
If nf = 7.5 Then
TextBox3.Text = "BUEN RESULTADO"
End If
If nf = 5.0 Then
TextBox3.Text = "DEBE ESFORZARSE MAS"
End If
If nf <= 2.5 Then
TextBox3.Text = "EL RESULTADO ES MUY MALO"
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
n1 = 0
n2 = 0
n3 = 0
n4 = 0
nf = 0
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub RadioButton16_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles RadioButton16.CheckedChanged
If RadioButton16.Enabled = True Then
n4 = 2.5
End If
If RadioButton16.Enabled = False Then
n4 = 0
End If
End Sub
Private Sub RadioButton11_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles RadioButton11.CheckedChanged
If RadioButton11.Enabled = True Then
n3 = 2.5
End If
If RadioButton11.Enabled = False Then
n3 = 0
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Me.Hide()
End Sub
End Class
10. Programa que maneje CheckBox
Public Class ChechBox
Dim sueldo, bonificacion, descuento, neto As Integer
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBoxBonificacion.CheckedChanged
If CheckBoxBonificacion.Checked = True Then
bonificacion = 450000
txtbonificacion.Text = bonificacion
Else
bonificacion = 0
txtbonificacion.Text = bonificacion
End If
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBoxDescuento.CheckedChanged
If CheckBoxDescuento.Checked = True Then
descuento = 180000
txtDescuento.Text = descuento
Else
descuento = 0
txtDescuento.Text = descuento
End If
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBoxSueldo.CheckedChanged
If CheckBoxSueldo.Checked = True Then
sueldo = 1500000
txtSueldo.Text = sueldo
Else
sueldo = 0
txtSueldo.Text = sueldo
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
neto = sueldo + bonificacion - descuento
txtResultado.text = neto.ToString("##.00")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
sueldo = 0
bonificacion = 0
descuento = 0
neto = 0
End Sub
End Class
CONCLUSIONES
Por medio del anterior trabajo los integrantes del grupo colaborativo nos apropiamos de los
conceptos bsicos, de Visual Basic 2010 sobre los de objetos, eventos, formas controles,
propiedades, variables y tipos de datos as como el uso de las herramientas y formularios
con sus propiedades aplicados a la prctica.
Se foment el trabajo colaborativo permitiendo la participacin de cada uno de los
integrantes, en el desarrollo del trabajo final realizando correcciones a los aportes
entregados.
BIBLIOGRAFA
http://www.visualstudio.com/es-es/visual-studio-homepage-vs.aspx
http://datateca.unad.edu.co/contenidos/201416/ayuda_linea/index.html
http://applink.foro.ag/t124-microsoft-visual-basic-2010-express
http://66.165.175.211/campus13_20141/file.php/30/ovas/ova_nueva1/Unidad_uno.htm
http://starvisualbasic.blogspot.com/
http://youtu.be/fCX5GcDOCUA
http://www.youtube.com/watch?v=SJkINAU8D-4
http://www.youtube.com/watch?v=K8346dFs_ZU
http://www.youtube.com/watch?v=Aj7gsgdESlI