Public Class Form2
Dim arreglo(0 To 3, 0 To 5)
Dim nro As Integer
Dim letra As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If CheckBox1.Checked = True Then
numeros()
ElseIf CheckBox2.Checked = True Then
End If
End Sub
Sub numeros()
For col = 0 To 3
For fil = 0 To 5
Randomize()
nro = (1 + Rnd() * 99)
arreglo(col, fil) = nro
Next
Next
For fil = 0 To 5
ListBox1.Items.Add(arreglo(0, fil) & "-" & arreglo(1, fil) & "-" & arreglo(2, fil) & "-" & arreglo(3, fil))
Next
End Sub
Sub posicion()
For col = 0 To 3
For fil = 0 To 5
arreglo(col, fil) = arreglo(Mid(TextBox1.Text, 1, 1), Mid(TextBox1.Text, 3, 1))
nro = arreglo(col, fil)
Label4.Text = nro
Next
Next
End Sub
Sub letras()
For col = 0 To 3
For fil = 0 To 5
letra = InputBox("ingrese la letra")
arreglo(col, fil) = letra
Next
Next
For fil = 0 To 5
ListBox1.Items.Add(arreglo(0, fil) & "-" & arreglo(1, fil) & "-" & arreglo(2, fil) & "-" & arreglo(3, fil))
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
posicion()
End Sub
End Class
reproductor
martes, 20 de marzo de 2012
lunes, 19 de marzo de 2012
Refuerzo: Validacion de datos
PublicClass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As String
n = InputBox("ingrese un valor")
If IsNumeric(n) Then
Label1.Text = "Valor numerico"
TextBox1.Text = nElse
Label1.Text = "Valor no valido"
TextBox1.Text = " "
End If
End Sub
End Class
miércoles, 7 de marzo de 2012
Usar control Datagridview
FORM1
FORM2
Private
Me.Hide()End Sub Class
Form2.Show()
End Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
FORM2
Private
Me.Hide()End Sub Class
Form2.Show()
End Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Public Class Form1
Dim IMC As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
IMC = Val(TextBox2.Text) / Val(TextBox3.Text) * Val(TextBox3.Text)
Form2.DataGridView1.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text, IMC)
MsgBox("Datos Ingresados")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Hide()
Form2.Show()
End Sub
End Class
lunes, 5 de marzo de 2012
Bingo
Public Class Form1
Dim n(0 To 4, 0 To 4)
Dim pos As Integer
Dim letra As String
Dim num As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bingo()
End Sub
Sub bingo()
For col = 0 To 4
For fil = 0 To 4
Randomize()
pos = (1 + Rnd() * 99)
num = 1 + Rnd() * 5
If num = 1 Then
letra = "B"
ElseIf num = 2 Then
letra = "I"
ElseIf num = 3 Then
letra = "N"
ElseIf num = 4 Then
letra = "G"
ElseIf num = 5 Then
letra = "O"
End If
n(col, fil) = letra & pos
Next
Next
For fil = 0 To 4
ListBox1.Items.Add(n(0, fil))
Next
End Sub
End Class
Dim n(0 To 4, 0 To 4)
Dim pos As Integer
Dim letra As String
Dim num As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bingo()
End Sub
Sub bingo()
For col = 0 To 4
For fil = 0 To 4
Randomize()
pos = (1 + Rnd() * 99)
num = 1 + Rnd() * 5
If num = 1 Then
letra = "B"
ElseIf num = 2 Then
letra = "I"
ElseIf num = 3 Then
letra = "N"
ElseIf num = 4 Then
letra = "G"
ElseIf num = 5 Then
letra = "O"
End If
n(col, fil) = letra & pos
Next
Next
For fil = 0 To 4
ListBox1.Items.Add(n(0, fil))
Next
End Sub
End Class
Suscribirse a:
Entradas (Atom)