Advertisement
wis3_guy

Simple GUI

Mar 13th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace simple_GUI
  11. {
  12.  
  13. public partial class Form1 : Form
  14. {
  15.  
  16. Customer myCustomer = new Customer(); //Declare an instance of the customer class within my Windows form
  17.  
  18. public Form1()
  19. {
  20. InitializeComponent();
  21. }
  22.  
  23. private void saveButton_Click(object sender, EventArgs e)
  24. {
  25. myCustomer.Id = Convert.ToInt32(customerIDTextBox.Text); //How to handle exceptions?
  26. myCustomer.Name = fullNameTextBox.Text;
  27. myCustomer.Address = addressTextBox.Text;
  28. myCustomer.Email = emailTextBox.Text;
  29. myCustomer.Phone = Convert.ToDouble(phoneNumberTextBox.Text);
  30. myCustomer.AddDate = Convert.ToDateTime(addressTextBox.Text);
  31. myCustomer.TotalTransactions = Convert.ToInt32(totalTransactionsTextBox.Text);
  32.  
  33.  
  34. }
  35.  
  36. private void retrieveButton_Click(object sender, EventArgs e)
  37. {
  38. customerIDTextBox.Text = Convert.ToString(myCustomer.Id); //Ask about the conversions
  39. fullNameTextBox.Text = myCustomer.Name;
  40. addressTextBox.Text = myCustomer.Address;
  41. emailTextBox.Text = myCustomer.Email;
  42. phoneNumberTextBox.Text = Convert.ToString(myCustomer.Phone);
  43. addDateTextBox.Text = Convert.ToString(myCustomer.AddDate);
  44. totalTransactionsTextBox.Text = Convert.ToString(myCustomer.TotalTransactions);
  45.  
  46. }
  47.  
  48. private void clearButton_Click(object sender, EventArgs e)
  49. {
  50. customerIDTextBox.Text = "";
  51. fullNameTextBox.Text = "";
  52. addressTextBox.Text = "";
  53. emailTextBox.Text = "";
  54. phoneNumberTextBox.Text = "";
  55. addDateTextBox.Text = "";
  56. totalTransactionsTextBox.Text = Convert.ToString("");
  57.  
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement