Empresa XYZ Public Class Form1 Inherits System.Windows.Forms

Anuncio
Empresa XYZ
Public Class Form1
Inherits System.Windows.Forms.Form
Dim Art(4) As String
Dim Tienda(3) As String
Dim Ventas(4, 3) As Single
Dim VenPA(4) As Single
Dim PromVPT(3) As Single
Dim M As Integer, N As Integer
Dim i As Integer, j As Integer
Dim S As Single
Dim cad As String
Private Sub BtnMatriz_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles BtnMatriz.Click
Dim Rpta As Boolean
Dim i As Integer, j As Integer
i = -1
Do
i = i + 1
j = -1
cad = ""
Do
j = j + 1
Ventas(i, j) = InputBox("Ing. venta :")
cad = cad & Ventas(i, j) & vbTab
Loop Until j = 2
LstVentas.Items.Add(cad)
'Rpta = MessageBox.Show("Desea seguir :", "MENSAJE",
MessageBoxButtons.YesNo)
Loop Until i = 3 'Rpta = vbNo
M = i
N = 2
End Sub
Private Sub BtnCalVA_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles BtnCalVA.Click
For i = 0 To M
S = 0
For j = 0 To N
S = S + Ventas(i, j)
Next j
VenPA(i) = S
Me.LstVenPA.Items.Add(VenPA(i))
Next i
End Sub
Private Sub BtnPromV_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles BtnPromV.Click
Dim Cad As String
Cad = ""
For j = 0 To N
S = 0
For i = 0 To M
S = S + Ventas(i, j)
Next i
PromVPT(j) = S / M
Cad = Cad & PromVPT(j) & vbTab
Next j
LstPromV.Items.Add(Cad)
End Sub
Private Sub BtnCalVT_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles BtnCalVT.Click
Dim VenTot As Single
VenTot = 0
For i = 0 To M
For j = 0 To N
VenTot = VenTot + Ventas(i, j)
Next j
Next i
TxtVT.Text = VenTot
End Sub
Private Sub BtnMaxV_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles BtnMaxV.Click
Dim MaxV As Single
Dim iMaxV, jMaxV As Integer
MaxV = Ventas(0, 0)
iMaxV = 0 : jMaxV = 0
For i = 0 To M
For j = 0 To N
If Ventas(i, j) > MaxV Then
MaxV = Ventas(i, j)
iMaxV = i : jMaxV = j
End If
Next j
Next i
MessageBox.Show("Max Venta = " & MaxV & " Art " & Art(iMaxV) &
" Tienda " & Tienda(jMaxV))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Tienda(0) = "T1" : Tienda(1) = "T2"
Tienda(2) = "T3"
Art(0) = "1"
Art(1) = "2"
Art(2) = "3"
Art(3) = "4"
For i = 0 To 3
Me.LstArt.Items.Add(Art(i))
Next i
cad = ""
cad = cad & Tienda(0) & vbTab & Tienda(1) & vbTab & Tienda(2)
LstTiendas.Items.Add(cad)
End Sub
End Class
Suma y resta de matrices
Public Class Form1
Inherits System.Windows.Forms.Form
Dim Mat1(10, 10) As Integer
Dim Mat2(10, 10) As Integer
Dim MatS(10, 10) As Integer
Dim MatR(10, 10) As Integer
Dim m As Integer, n As Integer
Dim cad As String
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)
m = TxtM.Text - 1
n = TxtN.Text - 1
Dim i As Integer, j As Integer
For i = 0 To m
cad = ""
For j = 0 To n
Mat1(i, j) = InputBox("Ing. numero")
cad = cad & Mat1(i, j) & vbTab
Next j
LstMat1.Items.Add(cad)
Next i
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Dim i As Integer, j As Integer
For i = 0 To m
cad = ""
For j = 0 To n
Mat2(i, j) = InputBox("Ing. numero")
cad = cad & Mat2(i, j) & vbTab
Next j
LstMat2.Items.Add(cad)
Next i
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Dim i As Integer, j As Integer
'Me.LstMat3.Items.Clear()
For i = 0 To m
cad = ""
For j = 0 To n
MatS(i, j) = Mat1(i, j) + Mat2(i, j)
cad = cad & MatS(i, j) & vbTab
Next j
LstMat3.Items.Add(cad)
Next i
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Dim i As Integer, j As Integer
'LstMat3.Items.Clear()
For i = 1 To m
cad = ""
For j = 1 To n
MatR(i, j) = Mat1(i, j) - Mat2(i, j)
cad = cad & MatR(i, j) & vbTab
Next j
LstMat3.Items.Add(cad)
Next i
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
m = TxtM.Text - 1
n = TxtN.Text - 1
Dim i As Integer, j As Integer
For i = 0 To m
cad = ""
For j = 0 To n
Mat1(i, j) = InputBox("Ing. numero")
cad = cad & Mat1(i, j) & vbTab
Next j
LstMat1.Items.Add(cad)
Next i
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim i As Integer, j As Integer
For i = 0 To m
cad = ""
For j = 0 To n
Mat2(i, j) = InputBox("Ing. numero")
cad = cad & Mat2(i, j) & vbTab
Next j
LstMat2.Items.Add(cad)
Next i
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
Dim i As Integer, j As Integer
Me.LstMat3.Items.Clear()
For i = 0 To m
cad = ""
For j = 0 To n
MatS(i, j) = Mat1(i, j) + Mat2(i, j)
cad = cad & MatS(i, j) & vbTab
Next j
LstMat3.Items.Add(cad)
Next i
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
Dim i As Integer, j As Integer
LstMat3.Items.Clear()
For i = 0 To m
cad = ""
For j = 0 To n
MatR(i, j) = Mat1(i, j) - Mat2(i, j)
cad = cad & MatR(i, j) & vbTab
Next j
LstMat3.Items.Add(cad)
Next i
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
Dim Cantidad(,) As Integer = {{2, 5, 0, 7}, {14, 1, 2, 3}, {4, 0,
3, 6}}
Dim Articulos() As Integer = {1, 2, 3, 4}
Dim Almacen() As Integer = {1, 2, 3}
Dim M, N As Integer
Dim i, j As Integer
Dim H(3), V(2) As Integer
Dim s As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Cad As String
M =
N =
s =
For
Cantidad.GetUpperBound(0)
Cantidad.GetUpperBound(1)
0
i = 0 To M
Cad = ""
For j = 0 To N
Cad = Cad & Cantidad(i, j) & vbTab
s = s + Cantidad(i, j)
Next j
ListBox3.Items.Add(Cad)
Me.TextBox1.Text = s
Next i
Cad = ""
For i = 0 To 3
Cad = Cad & Articulos(i) & vbTab
Next i
ListBox1.Items.Add(Cad)
For i = 0 To 2
ListBox2.Items.Add(Almacen(i))
Next i
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim Num As Integer
Num = Val(InputBox("Nro de Almacen: "))
i = Num - 1
For j = 0 To N
If Cantidad(i, j) = 0 Then MessageBox.Show("Esta agotado
el articulo " & j + 1)
Next j
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
For i = 0 To M
For j = 0 To N
If Cantidad(i, j) = 0 Then MessageBox.Show("Esta
agotado el articulo " & j + 1 & " almacen " & i + 1)
Next j
Next i
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
For i = 0 To M
s = 0
For j = 0 To N
s = s + Cantidad(i, j)
Next j
V(i) = s 'vertical
ListBox4.Items.Add(V(i))
Next i
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
Dim Cad As String
Cad = ""
For j = 0 To N
s = 0
For i = 0 To M
s = s + Cantidad(i, j)
Next i
H(i) = s 'horizontal
Cad = Cad & H(i) & vbTab
Next j
ListBox5.Items.Add(Cad)
End Sub
End Class
Public Class Form1
Inherits System.Windows.Forms.Form
Dim PreUni() As Integer = {50, 70, 75, 80}
Dim Modelos() As Integer = {1, 2, 3, 4}
Dim Matriz(10, 10) As Integer
Dim Vert(10) As Integer
Dim Hori(10) As Integer
Dim MonFPC(10) As Integer
Dim MonFPM(10) As Integer
Dim Cliente(10) As Integer
Dim M, i, j As Integer
Dim cad As String
Const N = 3
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cad = ""
For j = 0 To N
cad = cad & PreUni(j) & vbTab
Next j
ListBox1.Items.Add(cad)
cad = ""
For j = 0 To N
cad = cad & Modelos(j) & vbTab
Next j
ListBox5.Items.Add(cad)
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button5.Click
Dim Rpta As String
i = -1
Do
i = i + 1
Cliente(i) = i + 1
cad = ""
For j = 0 To N
Matriz(i, j) = Val(InputBox("ing. valor: "))
cad = cad & Matriz(i, j) & vbTab
Next
ListBox2.Items.Add(cad)
ListBox7.Items.Add(Cliente(i))
Rpta = MessageBox.Show("Desea seguir :", "MENSAJE",
MessageBoxButtons.YesNo)
Loop Until Rpta = vbNo
M = i
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim s As Integer
Call Vertical(Matriz, Vert, M, N)
For i = 0 To M
ListBox3.Items.Add(Vert(i))
Next i
For i = 0 To M
s = 0
For j = 0 To N
s = s + Matriz(i, j) * PreUni(j)
Next j
MonFPC(i) = s
Next i
For i = 0 To M
ListBox6.Items.Add(MonFPC(i))
Next i
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
Dim s As Integer
s = 0
For i = 0 To M
s = s + MonFPC(i)
Next i
Me.TextBox2.Text = s
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button4.Click
Me.TextBox1.Text = Suma(Matriz, M, N)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim s As Integer
Call Horizontal(Matriz, Hori, M, N)
cad = ""
For j = 0 To N
cad = cad & Hori(j) & vbTab
Next j
ListBox4.Items.Add(cad)
For j = 0 To N
MonFPM(j) = Hori(j) * PreUni(j)
Next j
'añadir a la lista
cad = ""
For j = 0 To N
cad = cad & MonFPM(j) & vbTab
Next j
ListBox8.Items.Add(cad)
End Sub
End Class
Descargar