Files
ASDV-C-Sharp/Student Sample Programs/Chap07/Display Elements/Display Elements/Form1.cs
2022-08-30 14:15:11 -05:00

43 lines
1.0 KiB
C#

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 Display_Elements
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void getNamesButton_Click(object sender, EventArgs e)
{
// Create an array to hold three strings.
const int SIZE = 3;
string[] names = new string[SIZE];
// Get the names.
names[0] = name1TextBox.Text;
names[1] = name2TextBox.Text;
names[2] = name3TextBox.Text;
// Display the names.
MessageBox.Show(names[0]);
MessageBox.Show(names[1]);
MessageBox.Show(names[2]);
}
private void exitButton_Click(object sender, EventArgs e)
{
// Close the form.
this.Close();
}
}
}