Programas En Visual Basic Sencillos
Enviado por callita • 15 de Febrero de 2012 • 2.563 Palabras (11 Páginas) • 1.305 Visitas
COMO CAMBIAR LA IMAGEN DE FONDO DEL FORMULARIO
Public Class fondo
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.BackgroundImage = My.Resources.amor
End Sub
COMO CAMBIAR EL COLOR DE FONDO, LA VISIBILIDAD, Y AGREGAR TEXTO DEL CONTROL
Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox2.BackColor = Color.Pink /Color de fondo/
TextBox2.Text = "saludo 2" /agregar texto al control/
caja3.Visible = True /propiedad visible del control/
End Sub
Private Sub salir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles salir.Click
End
End Sub
COMO CREAR FUNCIONES Y AGREGAR AUDIO
Public Class Saludo
Sub saludo1()
TextBox1.BackColor = Color.DarkViolet
TextBox1.Text = "Hola"
Button2.Enabled = True
Button1.Enabled = False
My.Computer.Audio.Play(My.Resources.ringin, AudioPlayMode.Background)
End Sub
Sub saludo2()
TextBox1.BackColor = Color.DarkViolet
TextBox1.Text = "Suerte te cuidas"
Button2.Enabled = False
Button1.Enabled = True
My.Computer.Audio.Play(My.Resources.Apagado_de_Windows_XP,AudioPlayMode.Background)’para agregar audio’
Me.BackgroundImage = My.Resources.J0384885
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
saludo1() /para llamar la función/
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
saludo2()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
TOTALIZAR CON CHECKBOX
Dim total As Integer
Const camiseta = 25000
Const pantalon = 30000
Const medias = 7000
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If (CheckBox1.Checked = True) Then
total += camiseta
Label2.Text = total
PictureBox1.Visible = True
Else
total -= camiseta
Label2.Text = total
PictureBox1.Visible = False
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If (CheckBox2.Checked = True) Then
total += pantalon
Label2.Text = total
PictureBox2.Visible = True
Else
total -= pantalon
Label2.Text = total
PictureBox2.Visible = False
End If
End Sub
CONVERSION DE HORAS MINUTOS Y SEGUNDOS
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (TextBox2.Text = "" And TextBox3.Text = "") Then
TextBox2.Text = Val(TextBox1.Text) * 60
TextBox3.Text = Val(TextBox1.Text) * 3600
ElseIf (TextBox1.Text = "" And TextBox3.Text = "") Then
TextBox1.Text = Val(TextBox2.Text) / 60
TextBox3.Text = Val(TextBox2.Text) * 60
ElseIf (TextBox1.Text = "" And TextBox2.Text = "") Then
TextBox1.Text = Val(TextBox3.Text) / 3600
TextBox2.Text = Val(TextBox3.Text) / 60
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
...