Operation
• The user enters a string that consists of a last name, an account code, and a password in this format: name, account code, password. (Each value separated by a comma.)
• When the Parse button is pressed the application parses the string into name, account code, and password and displays the result in the controls shown.
Specifications
• The application should check that a value is entered into the text box (i.e. it is not left blank.)
Enhancement
• The application should check that the value that is entered includes two commas.
• The application should provide for the user entering one or more spaces after each comma and at the beginning and end of the string.
1
Expert's answer
2012-11-27T11:02:49-0500
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.Windows.Forms;
namespace Parser { class Program { & static Form mainForm; & static TextBox input; & static Button parse;
& static void CreateMainForm() & { mainForm = new Form(); input = new TextBox(); parse = new Button(); lName = new Label(); lPassword = new Label(); lAccountCode = new Label();
mainForm.FormBorderStyle = FormBorderStyle.FixedToolWindow; mainForm.Size = new Size(303, 130);
input.Location = new Point(8, 10); input.Width = 200;
parse.Location = new Point(216, 8); parse.Text = "Parse"; parse.Click += new EventHandler(ParseClick);
Comments
Leave a comment