Exemplo n.º 1
0
 private void Button1_Click(object sender, EventArgs e)
 {
     kind = Coffee.StringToKind(cbKind.SelectedItem.ToString());
 }
Exemplo n.º 2
0
        private void BtAction_Click(object sender, EventArgs e)
        {
            int    sugar = 0;
            double price = 0;

            if (tbSort.Text != "" && Coffee.StringIsBool(tbCream.Text) &&
                Int32.TryParse(tbSugar.Text, out sugar) && sugar >= 0 && sugar <= 10)
            {
                coffee       = new Coffee(tbSort.Text, Coffee.StringToKind(cbKind.SelectedItem.ToString()), sugar, Coffee.StringToBool(tbCream.Text), price);
                DialogResult = DialogResult.OK;
                MessageBox.Show(cbKind.SelectedItem.ToString());
            }
            else
            {
                MessageBox.Show("Вы ввели некорректные данные. Повторите ввод.", "Ошибка");
            }
        }