GirfanovR.A.
GirfanovR.A.

Reputation: 29

How to make so that you can only enter a date?

So I need to do so in the "Year", you can enter the date only. To pop up a warning something. Here's the code, if the user enters an empty value, you need to add?

if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "")
            {
                MessageBox.Show("Не заполнены все поля!");
                return;
            }

Upvotes: 2

Views: 91

Answers (2)

Biktimirova
Biktimirova

Reputation: 58

Put together textBox dateTimePicker, further: string date=dateTimePicker1.Value.ToString ("dd.mm.yy")

Upvotes: 1

Mr Bakirov
Mr Bakirov

Reputation: 43

And why in the "Year" the whole date? Plug the NumericUpDown to the limitations of values and the whole business.)))

Upvotes: 2

Related Questions