Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim btn As New Button(), lb As New Label(), lb2 As New Label(), lb3 As New Label(), lb4 As New Label(), lb5 As New Label(), txb As New TextBox(), txb2 As New TextBox(), txb3 As New TextBox(), txb4 As New TextBox() Dim r1, r2, r3 As Double r1 = Val(txb.Text) r2 = Val(txb2.Text) r3 = Val(txb3.Text) r4 = Val(txb4.Text) resul = Val(r1) + Val(r2) With btn .Text = "aceptar" .Location = New System.Drawing.Point(210, 260) .Size = New System.Drawing.Size(80, 30) End With With lb .Text = "numero de turismos" .Location = New System.Drawing.Point(10, 40) .Size() = New System.Drawing.Size(60, 40) End With With lb2 .Text = "numero de todoterrenos" .Location = New System.Drawing.Point(10, 80) .Size() = New System.Drawing.Size(80, 40) End With With lb3 .Text = "capacidad de turismos (litros)" .Location = New System.Drawing.Point(10, 120) .Size() = New System.Drawing.Size(70, 40) End With With lb4 .Text = "capacidad de todoterrenos(litros)" .Location = New System.Drawing.Point(10, 180) .Size() = New System.Drawing.Size(80, 40) End With With lb5 .Text = "necesidades totales de combustibles" .Location = New System.Drawing.Point(10, 230) .Size() = New System.Drawing.Size(80, 50) End With
With txb .Location = New System.Drawing.Point(120, 40) .Size() = New System.Drawing.Size(70, 20) End With With txb2 .Location = New System.Drawing.Point(120, 80) .Size() = New System.Drawing.Size(70, 20) End With With txb3 .Location = New System.Drawing.Point(120, 120) .Size() = New System.Drawing.Size(70, 20) End With With txb4 .Location = New System.Drawing.Point(120, 180) .Size() = New System.Drawing.Size(70, 20) End With
Me.Controls.Add(btn) Me.Controls.Add(lb) Me.Controls.Add(lb2) Me.Controls.Add(lb3) Me.Controls.Add(lb4) Me.Controls.Add(lb5) Me.Controls.Add(txb) Me.Controls.Add(txb2) Me.Controls.Add(txb3) Me.Controls.Add(txb4) Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1. Click Dim r1, r2, r3, r4, res As Double r1 = Val(TextBox1.Text) r2 = Val(TextBox2.Text) r3 = Val(TextBox3.Text) r4 = Val(TextBox4.Text) res = r1 * r3 + r2 * r4 TextBox5.Text = res Button1.Text = "aceptar" End Sub End Class