You are on page 1of 4

MINISTERIO DE EDUCACION

UNIVERSIDAD TECNOLOGICA
DE PANAMA

FACULTAD DE INGENIERIA CIVIL

DATAGRIDVIEW
2

TAREA 2

SHANTALL PINO

8-906-1627

1IC 124 B
Public Class Form1
Dim i As Integer = 0 REM i contador de items agregados
Dim tventas, tcostos, tmargen As Integer REM variables
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
DataGridView1.RowCount = 20 REM dimensiones el tamao del grip
Me.Text = "MATERIALES DE CONSTRUCCION EMPRESA GP"
Label5.Text = Environ("Computername")
Label6.Text = Environ("Username")
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


REM boton de adicionar
DataGridView1.Item(0, i).Value = (TextBox1.Text)
DataGridView1.Item(1, i).Value = (TextBox2.Text)
DataGridView1.Item(2, i).Value = (TextBox3.Text)
DataGridView1.Item(3, i).Value = (TextBox2.Text) - (TextBox3.Text)
REM contador de registros agregados al control
i = i + 1 REM contador boton adicionar
tventas = tventas + Val(TextBox2.Text)
tcostos = tcostos + Val(TextBox3.Text)
tmargen = tmargen + Val(TextBox2.Text - TextBox3.Text)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


REM limpiamos el control y colocamos el contador en cero y dimensiono tamao
del control
DataGridView1.Rows.Clear()
i=0
DataGridView1.RowCount = 20 REM dimensionas el tamao del grip
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


TextBox4.Text = tventas
TextBox5.Text = tcostos
TextBox6.Text = tmargen
i = i + 1 REM contador se incrementa
DataGridView1.Item(0, i).Value = "Fin de programa"
End Sub
End Class

You might also like