For school we have to develop a product manager. The basic task is to add new products. A product has a name and a price.I know the one or other class is currently pretty empty but its planned to add more methods.The code is developed in MVC-format and comments plus texts are in German.I would like to know what's good and what's bad (also why) and how I can improve the code in design, structure, variable/method naming, performance.Program.csusing System;using Ferienaufgabe_2.Controller;namespace Ferienaufgabe_2{    static class Program    {        /// <summary>        /// Der Haupteinstiegspunkt fr die Anwendung.        /// </summary>        [STAThread]        static void Main()        {           ProductList productList = new ProductList();           productList.RenderView();        }    }}Controller/ProductList.csusing System.Windows.Forms;namespace Ferienaufgabe_2.Controller{    class ProductList    {        public void RenderView()        {            Application.EnableVisualStyles();            Application.SetCompatibleTextRenderingDefault(false);            Application.Run(new View.ProductList());        }    }}Model/Product.csnamespace Ferienaufgabe_2.Model{class Product{    private string productname;    private decimal price;    public Product(string productname, decimal price)    {        this.Productname = productname;        this.Price = price;    }    private string Productname    {        set        {            this.productname = value;        }        get        {            return this.productname;        }    }    private decimal Price    {        set        {            this.price = value;        }        get        {            return this.price;        }    }}}Utility/Validate.csusing System.Text.RegularExpressions;namespace Ferienaufgabe_2.Utility{class Validate{    public bool IsValidPriceFormat(string value)    {        string strRegex = @^[0-9]{1,}([\,]{0,1}[0-9]{1,2}){0,1}$;        Regex myRegex = new Regex(strRegex, RegexOptions.None);        Match myMatch = myRegex.Match(value);        if (myMatch.Success)        {            return true;        }        return false;    }}}View/ProductList.csBuild with MS VS 2015 RC - form designerusing System;using System.Drawing;using System.Windows.Forms;namespace Ferienaufgabe_2.View{public partial class ProductList : Form{    private string defaultTextAddProductTextBox;    private string messageMissingProductname;    public ProductList()    {        InitializeComponent();        // Translations        this.Text = Produkteingabe;        this.defaultTextAddProductTextBox = Produktname;        this.messageMissingProductname = Bitte einen Produktnamen angeben.;    }    private void textBoxAddProduct_Enter(object sender, EventArgs e)    {        if (this.textBoxAddProduct.Text == this.defaultTextAddProductTextBox)        {            this.textBoxAddProduct.ForeColor = Color.Black;            this.textBoxAddProduct.Text = ;        }    }    private void textBoxAddProduct_Leave(object sender, EventArgs e)    {        if (this.textBoxAddProduct.Text.Trim().Length == 0)        {            this.textBoxAddProduct.Text = this.defaultTextAddProductTextBox;            this.textBoxAddProduct.ForeColor = Color.Gray;        }    }    private void textBoxAddProduct_KeyUp(object sender, KeyEventArgs e)    {        if (e.KeyCode == Keys.Enter)        {            this.AddProductToList();        }    }    private void buttonAddProduct_Click(object sender, EventArgs e)    {        this.AddProductToList();    }    protected bool AddProductToList()    {        if (this.textBoxAddProduct.Text.Trim().Length == 0)        {            MessageBox.Show(this.messageMissingProductname);            return false;        }        decimal productPrice = Prompt.ShowPriceDialog();        this.productBindingSource.Add(new Model.Product(this.textBoxAddProduct.Text, productPrice));        this.textBoxAddProduct.Text = this.defaultTextAddProductTextBox;        this.textBoxAddProduct.ForeColor = Color.Gray;        this.dataGridViewProductList.Focus();        return true;    }}}View/Prompt.csusing System;using System.Windows.Forms;using Ferienaufgabe_2.Utility;using System.Drawing;namespace Ferienaufgabe_2.View{static class Prompt{    public static decimal ShowPriceDialog()    {        Validate validator = new Validate();        // Create form and its fields        Form prompt = new Form();        Label textLabel = new Label();        TextBox inputBox = new TextBox();        Button confirmation = new Button();        // Translations        string defaultTextInputBox = z.B.: 10,00;        string messageInvalidPriceFormat = Ungltige Preiseingabe! Z.B.: 10,00;        string textOfLabel = Preis;        string textOfConfirmButton = Prozess abschliessen;        // Design form and its fields        prompt.Width = 300;        prompt.Height = 120;        prompt.StartPosition = FormStartPosition.CenterParent;        prompt.FormBorderStyle = FormBorderStyle.None;        textLabel.Location = new Point(110, 15);        textLabel.Text = textOfLabel;        textLabel.Font = new Font(Arial, 18);        inputBox.Location = new Point(40, (textLabel.Location.Y + textLabel.Height + 10));        inputBox.Width = 205;        inputBox.Text = defaultTextInputBox;        inputBox.ForeColor = Color.Gray;        confirmation.Location = new Point(40, (inputBox.Location.Y + inputBox.Height + 10));        confirmation.Width = inputBox.Width;        confirmation.Text = textOfConfirmButton;        // Add events        inputBox.KeyUp += (sender, e) => {            if (e.KeyCode == Keys.Enter && validator.IsValidPriceFormat(inputBox.Text))            {                prompt.Close();            }            else if (e.KeyCode == Keys.Enter)            {                textLabel.Focus();                MessageBox.Show(messageInvalidPriceFormat);            }        };        confirmation.Click += (sender, e) => {            if (validator.IsValidPriceFormat(inputBox.Text))            {                prompt.Close();            }            else            {                textLabel.Focus();                MessageBox.Show(messageInvalidPriceFormat);            }        };        inputBox.GotFocus += (sender, e) =>        {            if (inputBox.Text == defaultTextInputBox)            {                inputBox.Text = ;                inputBox.ForeColor = Color.Black;            }        };        inputBox.LostFocus += (sender, e) =>        {            if (inputBox.Text.Trim().Length == 0)            {                inputBox.Text = defaultTextInputBox;                inputBox.ForeColor = Color.Gray;            }        };        // Add fields to form        prompt.Controls.Add(textLabel);        prompt.Controls.Add(inputBox);        prompt.Controls.Add(confirmation);        // Show dialog        prompt.ShowDialog();        // Return converted input. This goes well anytime due to a check in the dispose actions.        return Convert.ToDecimal(inputBox.Text);    }}}
Product Manager managing product listings and prices
c#;mvc;regex
   if (myMatch.Success)   {       return true;   }   return false;That's an awful lot of code for a simple thing. Why not directly return the value?return myMatch.Success;myMatch isn't a very good name either. C# is case sensitive, so you could simply use match. In fact, this whole block suffers from some poor naming.    string strRegex = @^[0-9]{1,}([\,]{0,1}[0-9]{1,2}){0,1}$;   Regex myRegex = new Regex(strRegex, RegexOptions.None);   Match myMatch = myRegex.Match(value);The latter two can be solved by taking advantage of casing, but what about strRegex??? Why, we just call it what it is, a (regex) pattern.     string pattern = @^[0-9]{1,}([\,]{0,1}[0-9]{1,2}){0,1}$;    Regex regex = new Regex(pattern, RegexOptions.None);    Match match = regex.Match(value);Whenever possible, avoid both static methods and newing objects inside your methods. Both make tests difficult to write. public static decimal ShowPriceDialog(){    Validate validator = new Validate();    // Create form and its fields    Form prompt = new Form();    Label textLabel = new Label();    TextBox inputBox = new TextBox();    Button confirmation = new Button();Pass things as parameters, or through the ctor instead. It's called Dependency Injection, you'd do well to study it. Don't go thinking you need some special framework or anything though. Look into Pure DI a.k.a. Poor man's DI.Lastly, I think you missed the model-view-controller pattern by a bit. The controller doesn't seem to do much, while the views's code behinds are doing an awful lot of work. 