0% found this document useful (0 votes)
35 views5 pages

Form1: "Ingrese La Possicion" ","

The document contains code for a Windows form application that performs matrix addition. It defines 3 matrices (mat1, mat2, suma) and buttons to populate the matrices from user input, add the matrices, and display the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views5 pages

Form1: "Ingrese La Possicion" ","

The document contains code for a Windows form application that performs matrix addition. It defines 3 matrices (mat1, mat2, suma) and buttons to populate the matrices from user input, add the matrices, and display the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Public Class Form1

Dim mat1(3, 3) As Integer


Dim mat2(3, 3) As Integer
Dim suma(3, 3) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
For x = 1 To 3
For y = 1 To 3
mat1(x, y) = InputBox("Ingrese la possicion" & Str(x) & "," &
Str(y))

Next
Next
For x = 1 To 3
ListBox1.Items.Add(Str(mat1(x, 1)) & " " & Str(mat1(x, 2)) & " " &
Str(mat1(x, 3)))

Next
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
For x = 1 To 3
For y = 1 To 3
mat2(x, y) = InputBox("Ingrese la possicion" & Str(x) & "," &
Str(y))

Next
Next
For x = 1 To 3
ListBox2.Items.Add(Str(mat2(x, 1)) & " " & Str(mat2(x, 2)) & " " &
Str(mat2(x, 3)))

Next
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
For x = 1 To 3
For y = 1 To 3
suma(x, y) = mat1(x, y) + mat2(x, y)

Next
Next
For x = 1 To 3
ListBox3.Items.Add(Str(suma(x, 1)) & " " & Str(suma(x, 2)) & " " &
Str(suma(x, 3)))

Next
End Sub
End Class


Cuadrado mgico










Public Class Form1

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = Now
End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
TextBox2.Text = Year(Now)
End Sub

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox3.TextChanged
TextBox3.Text = Month(Now)
End Sub

Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox4.TextChanged
TextBox4.Text = MonthName(Month(Date.Now), False)

End Sub

Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox5.TextChanged
TextBox5.Text = Day.Default
End Sub

Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox6.TextChanged
TextBox6.Text = TimeOfDay
End Sub

Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox7.TextChanged
TextBox7.Text = Hour(TimeOfDay)
End Sub

Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox8.TextChanged
TextBox8.Text = Minute(TimeOfDay)
End Sub

Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox9.TextChanged
TextBox9.Text = Second(TimeOfDay)
End Sub

Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox10.TextChanged
TextBox10.Text = WeekdayName(Weekday(Date.Now), False)

End Sub
End Class






Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox2.Text = Math.Abs(Val(TextBox1.Text))
TextBox3.Text = Math.Sqrt(Val(TextBox1.Text))
TextBox4.Text = Math.Round(Val(TextBox1.Text))
TextBox5.Text = Math.Sin(Val(TextBox1.Text) * Math.PI / 180)
TextBox6.Text = Math.Tan(Val(TextBox1.Text) * Math.PI / 180)
TextBox7.Text = 1 / Math.Tan(Val(TextBox1.Text) * Math.PI / 180)
End Sub
End Class

You might also like