0 оценок0% нашли этот документ полезным (0 голосов)
14 просмотров3 страницы
The document describes two Visual Basic .NET programs. The first program calculates a person's age in days by multiplying their age in years by 365. The second program builds a basic calculator that performs the four basic math operations - addition, subtraction, multiplication, and division - on two numeric values input by the user and displays the result.
The document describes two Visual Basic .NET programs. The first program calculates a person's age in days by multiplying their age in years by 365. The second program builds a basic calculator that performs the four basic math operations - addition, subtraction, multiplication, and division - on two numeric values input by the user and displays the result.
The document describes two Visual Basic .NET programs. The first program calculates a person's age in days by multiplying their age in years by 365. The second program builds a basic calculator that performs the four basic math operations - addition, subtraction, multiplication, and division - on two numeric values input by the user and displays the result.
1. Sa se realizeze o forma care calculeaza numarul de zile din varsta cuiva.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Declaram variabilele Dim intAgeInYears, intAgeInDays As Integer 'Input - ia o valoare de la tastura si o pune in intAgeInYears intAgeInYears = txtAgeInYears.Text 'Procesarea intAgeInDays = intAgeInYears * 365 'nu se iau in considerare anii bisecti 'Output lblAgeInDays.Text = "Varsta ta in zile este: " & intAgeInDays
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End End Sub End Class 2. Sa se construiasca un calculator cu opertiile de baza.
Public Class Form1
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Label1.Text = Val(text1.Text) + Val(text2.Text) End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Label1.Text = Val(text1.Text) - Val(text2.Text) End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Label1.Text = Val(text1.Text) * Val(text2.Text) End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Label1.Text = Val(text1.Text) / Val(text2.Text) End Sub End Class