Advertisement
hoscanoa

Pregunta1 POO-I Final

Apr 4th, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.27 KB | None | 0 0
  1. Imports misFunciones
  2. Imports System.IO
  3. Imports System.Xml.Serialization
  4.  
  5. Public Class Form1
  6.  
  7.     Private Sub btnOtra_Click(sender As Object, e As EventArgs) Handles btnOtra.Click
  8.         txtSimple.Clear()
  9.         txtDoble.Clear()
  10.         txtTriple.Clear()
  11.         lblSimple.Text = "$0.00"
  12.         lblDoble.Text = "$0.00"
  13.         lblTriple.Text = "$0.00"
  14.         lblTotal.Text = "$0.00"
  15.         txtSimple.Focus()
  16.     End Sub
  17.  
  18.     Private Sub btnGenerar_Click(sender As Object, e As EventArgs) Handles btnGenerar.Click
  19.         For Each c In Me.Controls
  20.             If TypeOf c Is TextBox Then
  21.                 If c.Text.trim = "" Then
  22.                     c.text = "0"
  23.                 End If
  24.             End If
  25.         Next
  26.  
  27.         lblSimple.Text = "$" + Funciones.subtotal(CInt(txtSimple.Text), Val(lblPrecioSimple.Text.Substring(1))).ToString("0.00")
  28.         lblDoble.Text = "$" + Funciones.subtotal(CInt(txtDoble.Text), Val(lblPrecioDoble.Text.Substring(1))).ToString("0.00")
  29.         lblTriple.Text = "$" + Funciones.subtotal(CInt(txtTriple.Text), Val(lblPrecioTriple.Text.Substring(1))).ToString("0.00")
  30.  
  31.         Dim v(0 To 2) As Double
  32.  
  33.         v(0) = Val(lblSimple.Text.Substring(1))
  34.         v(1) = Val(lblDoble.Text.Substring(1))
  35.         v(2) = Val(lblTriple.Text.Substring(1))
  36.  
  37.         lblTotal.Text = "$" + Funciones.calcularTotal(v).ToString("0.00")
  38.  
  39.     End Sub
  40.  
  41.     Private Sub btnXML_Click(sender As Object, e As EventArgs) Handles btnXML.Click
  42.         Dim sv As New SaveFileDialog
  43.         sv.Filter = "Archivo XML|*.xml"
  44.         Try
  45.             If sv.ShowDialog Then
  46.                 Using fs As New FileStream(sv.FileName, FileMode.Create)
  47.                     Dim p As New Pedido
  48.                     With p
  49.                         .subtotalSimple = CDbl(lblSimple.Text.Substring(1))
  50.                         .subtotalDoble = CDbl(lblDoble.Text.Substring(1))
  51.                         .subtotalTriple = CDbl(lblTriple.Text.Substring(1))
  52.                         .montoTotal = CDbl(lblTotal.Text.Substring(1))
  53.                     End With
  54.  
  55.                     Dim xml As New XmlSerializer(GetType(Pedido))
  56.                     xml.Serialize(fs, p)
  57.                 End Using
  58.             End If
  59.         Catch ex As Exception
  60.  
  61.         End Try
  62.     End Sub
  63. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement