Ejemplos basicos para programar en visual basic 2008

Solo disponible en BuenasTareas
  • Páginas : 13 (3237 palabras )
  • Descarga(s) : 0
  • Publicado : 1 de junio de 2011
Leer documento completo
Vista previa del texto
PROGRAMA 1
[pic]
Public Class Form1

Private Sub cmdboton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdboton1.Click
MsgBox("Hola Mundo")
End Sub

End Class

PROGRAMA 2
[pic]
Public Class Form1
Dim cos, des, tot As Single
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End SubPrivate Sub BTNtotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNtotal.Click
cos = InputBox("Introduce el costo real", "Calculo de descuento", "")
des = InputBox("Introduce el costo pagado del articulo", "Calculo de descuento", "")
tot = (100 / cos) * des
Dim tot1 = 100 - tot
TXTdesc.Text = tot1 & "%"
End SubPrivate Sub BTNexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNexit.Click
End
End Sub
End Class

PROGRAMA 3
[pic]
Public Class FRMdicctionary

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LBLtitle.Click

End Sub

Private Sub BTNexit_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles BTNexit.Click
End
End Sub

Private Sub CMBespañol_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMBespañol.SelectedIndexChanged
CMBenglish.SelectedIndex = CMBespañol.SelectedIndex
End Sub

Private Sub CMBenglish_SelectedIndexChanged(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles CMBenglish.SelectedIndexChanged
CMBespañol.SelectedIndex = CMBenglish.SelectedIndex
End Sub
End Class

PROGRAMA 4
[pic]
[pic]

Public Class Form1

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim var1, var2 As Integer
var1 = TXTvar1.Text
var2 = TXTvar2.TextTXTtotal.Text = var1 * var2
End Sub

Private Sub BTNmas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNmas.Click
Dim var1, var2 As Integer
var1 = TXTvar1.Text
var2 = TXTvar2.Text
TXTtotal.Text = var1 + var2
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton2.Click
Dim var1, var2 As Integer
var1 = TXTvar1.Text
var2 = TXTvar2.Text
TXTtotal.Text = var1 - var2
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim var1, var2 As Integer
var1 = TXTvar1.Text
var2 = TXTvar2.Text
TXTtotal.Text = var1 / var2End Sub

Private Sub BTNsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNsalir.Click
End
End Sub

Private Sub TabPage2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage2.Click

End Sub

Private Sub BTNtriangle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesBTNtriangle.Click
Dim b, h As Single
b = InputBox("Introduce la base del triangulo", "Area de un Triangulo", "")
h = InputBox("Introduce la altura del triangulo", "Area de un Triangulo", "")
TXTresult.Text = (b * h) / 2
End Sub

Private Sub BTNcircle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNcircle.Click
Dim r As Singler = InputBox("Introduce el radio del circulo", "Area del circulo", "")
TXTresult.Text = 3.1416 * (r * r)
End Sub

Private Sub BTNcuadre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNcuadre.Click
Dim l1, l2 As Single
l1 = InputBox("Introduce los lados del triangulo", "Area de un Cuadrado", "")
l2 = l1...
tracking img