You are on page 1of 4

Centena, decena, unidad

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim n, b, c, aux, d As Integer
n = TextBox1.Text
b = n \ 100
d = n Mod 100
c = d \ 10
aux = d Mod 10

TextBox2.Text = b
TextBox3.Text = c
TextBox4.Text = aux

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Close()
End Sub
End Class

descuento

Public Class Form1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Dim p, c, t As Double
p = TextBox1.Text
c = TextBox2.Text
t = p * c
If t >= 100 Then
TextBox3.Text = t * 0.9
End If
If t < 100 Then
TextBox3.Text = t
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
Close()
End Sub
End Class

Ordenar

Public Class Form1

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label3.Click

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim a, b, c, aux As Integer
a = TextBox1.Text
b = TextBox2.Text
c = TextBox3.Text
If a > b Then
aux = a
a = b
b = aux
Else
a = a
b = b

End If
If b > c Then
aux = b
b = c
c = aux
Else
b = b
c = c

End If
If a > b Then
aux = a
a = b
b = aux
Else
a = a
b = b
End If
TextBox4.Text = a
TextBox5.Text = b
TextBox6.Text = c
End Sub
End Class

Ordenar 4 numeros (de menor a mayor)

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim a, b, c, d, aux As Integer
a = TextBox1.Text
b = TextBox2.Text
c = TextBox3.Text
d = TextBox4.Text
If a > b Then
aux = a
a = b
b = aux
If a > c Then
aux = a
a = c
c = aux
If a > d Then
aux = a
a = d
d = aux
Else
a = a
d = d
End If
Else
a = a
c = c
End If
Else
a = a
b = b
End If
If b > c Then
aux = b
b = c
c = aux
If b > d Then
aux = b
b = d
d = aux
Else
b = b
d = d
End If
b = b
c = c
End If
If c > d Then
aux = c
c = d
d = aux
Else
c = c
d = d
End If
TextBox5.Text = a
TextBox6.Text = b
TextBox7.Text = c
TextBox8.Text = d
End Sub
End Class

You might also like