0% found this document useful (0 votes)
23 views

Visula Basic Express 2

This document contains a student assignment to create a Visual Basic program using a datagrid. It includes: 1) An outline of the form design with a datagrid. 2) The code to populate the datagrid with input from textboxes, calculate totals for sales, costs, and margins, and clear the datagrid and totals. 3) A description that the program was executed successfully to input and total sales, costs, and margin data in a datagrid.

Uploaded by

Dayana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Visula Basic Express 2

This document contains a student assignment to create a Visual Basic program using a datagrid. It includes: 1) An outline of the form design with a datagrid. 2) The code to populate the datagrid with input from textboxes, calculate totals for sales, costs, and margins, and clear the datagrid and totals. 3) A description that the program was executed successfully to input and total sales, costs, and margin data in a datagrid.

Uploaded by

Dayana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Universidad Tecnológica de Panamá

Facultad de Ingeniería Civil

Programación

Tarea Nº2

Tema:

Visual Basic Express

Nombre:

Dayana Castrejón

Cédula:

8-922-714

Grupo:

1IC124

Profesor:

Emilio Batista

Fecha:

Mayo 09,2017
Tarea Nº2

Visual Basic Express

Datagrid
a) Diseño del Formulario:

b) Códigos del Programa:


Public Class Form1
Dim I As Integer = 0
Dim tventas, tcostos, tmargenes As Integer

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles


MyBase.Load
DataGridView1.RowCount = 10
Me.Text = "Materiales de Construcción, Empresa DC"
Label5.Text = Environ("ComputerName")
Label6.Text = Environ("username")

End Sub

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


Button1.Click
I = I + 1

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 = (TextBox3.Text) - (TextBox2.Text)
tventas = tventas + Val(TextBox2.Text)
tcostos = tcostos + Val(TextBox3.Text)
tmargenes = tmargenes + Val((TextBox3.Text) - (TextBox2.Text))

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""

TextBox4.Text = tventas
TextBox5.Text = tcostos
TextBox6.Text = tmargenes

End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
DataGridView1.Rows.Clear()
I = 0
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""

End Sub
End Class

c) Programa Ejecutado:

You might also like