Created
July 6, 2014 18:18
-
-
Save Fhernd/05f8319fe3301496203b to your computer and use it in GitHub Desktop.
Crear formulario para solicitar la cantidad de producto a vender o a pedir.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===++=== | |
// | |
// OrtizOL | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase: FormCantidad.cs | |
// | |
// Propósito: Crear formulario para solicitar la cantidad | |
// de producto a vender o a pedir. | |
// | |
============================================================*/ | |
using System; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Windows.Forms; | |
namespace LaTienda.GUI | |
{ | |
/// <summary> | |
/// Diálogo para solicitar la cantidad de producto a vender o pedir. | |
/// </summary> | |
public partial class FormCantidad : Form | |
{ | |
#region Campos (componentes de interfaz) | |
/// <summary> | |
/// Control padre. | |
/// </summary> | |
private ControlOperaciones padre; | |
#endregion | |
#region Constructores | |
/// <summary> | |
/// Crea el diálog para solicitar la cantidad a vender o a pedir. | |
/// </summary> | |
/// <param name="padre">Control padre.</param> | |
public FormCantidad(ControlOperaciones padre) | |
{ | |
InitializeComponent(); | |
this.padre = padre; | |
} | |
#endregion | |
#region eventos | |
/// <summary> | |
/// Acepta la cantidad introducida. | |
/// </summary> | |
/// <param name="sender">Generador del evento.</param> | |
/// <param name="e">Argumentos del evento.</param> | |
private void btnOK_Click(object sender, EventArgs e) | |
{ | |
int resultado; | |
if (Int32.TryParse(txtCantidad.Text, out resultado)) | |
{ | |
padre.CantidadIntroducida = resultado; | |
} | |
else | |
{ | |
MessageBox.Show(this, "No introdujo un valor entero válido.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); | |
} | |
} | |
/// <summary> | |
/// Cancela la cantidad del producto a vender o a pedir. | |
/// </summary> | |
/// <param name="sender">Generador del evento.</param> | |
/// <param name="e">Argumentos del evento.</param> | |
private void btnCancelar_Click(object sender, EventArgs e) | |
{ | |
this.Close(); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment