I have a Textbox named txtage.text.Now I want When Insert in txtage.text as 30/12/1980.
disable tabindex.and messagebox show "You can not give admission".If Insert in txtage.text as 30/12/2005.
Enable Tab index .its mean student 's age must be 6 year not greater nor less.

Recommended Answers

All 5 Replies

You can simply disable textBox:

txtage.Enabled = false;

Hello Sir this is not Solution of my question I want Students age must be minimum 6 years old.If Student's age is 10 years old Messagebox show "You can not admit in this School".

Why not use a DateTimePicker control to input a date, instead of a TextBox?
A DateTimePicker has ValueChanged and Validating events you could use to check the date entered and act accordingly.

I have a Textbox named txtage.text.Now I want When Insert in txtage.text as 30/12/1980.
disable tabindex.and messagebox show "You can not give admission".If Insert in txtage.text as 30/12/2005.
Enable Tab index .its mean student 's age must be 6 year not greater nor less.

1st of all, your post in not clear. Make is so, if you wanna help from us.
About what/which tabIndexes are you talkin about?

And when you work with dates, its best to use a control which is meant for it - so dateTimePicker as ddanbe told you.

Ok this thread is solved by ddanbe.It should be datetimePicker.and So Sorry Mitja I could not explain,what i'm want to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.