Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace simple_GUI
- {
- public partial class Form1 : Form
- {
- Customer myCustomer = new Customer(); //Declare an instance of the customer class within my Windows form
- public Form1()
- {
- InitializeComponent();
- }
- private void saveButton_Click(object sender, EventArgs e)
- {
- myCustomer.Id = Convert.ToInt32(customerIDTextBox.Text); //How to handle exceptions?
- myCustomer.Name = fullNameTextBox.Text;
- myCustomer.Address = addressTextBox.Text;
- myCustomer.Email = emailTextBox.Text;
- myCustomer.Phone = Convert.ToDouble(phoneNumberTextBox.Text);
- myCustomer.AddDate = Convert.ToDateTime(addressTextBox.Text);
- myCustomer.TotalTransactions = Convert.ToInt32(totalTransactionsTextBox.Text);
- }
- private void retrieveButton_Click(object sender, EventArgs e)
- {
- customerIDTextBox.Text = Convert.ToString(myCustomer.Id); //Ask about the conversions
- fullNameTextBox.Text = myCustomer.Name;
- addressTextBox.Text = myCustomer.Address;
- emailTextBox.Text = myCustomer.Email;
- phoneNumberTextBox.Text = Convert.ToString(myCustomer.Phone);
- addDateTextBox.Text = Convert.ToString(myCustomer.AddDate);
- totalTransactionsTextBox.Text = Convert.ToString(myCustomer.TotalTransactions);
- }
- private void clearButton_Click(object sender, EventArgs e)
- {
- customerIDTextBox.Text = "";
- fullNameTextBox.Text = "";
- addressTextBox.Text = "";
- emailTextBox.Text = "";
- phoneNumberTextBox.Text = "";
- addDateTextBox.Text = "";
- totalTransactionsTextBox.Text = Convert.ToString("");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement