Pass DatePicker.Value of one form to another form?
i have a login form that accepts an admin and ordinary users.
when an admin logs-in, his form has two DateTimePickers.
the first DateTimePicker allows the admin to choose a date that will serve as a minimum date = MinDate.
the second DateTimePicker allows the admin to choose a date 开发者_开发百科that will serve as a maximum date = MaxDate.
click ok and both MinDate and MaxDate should be saved even when the application exited.
now, if an ordinary user logs-in his form has one DateTimePicker which allows him to choose a date. however, that DateTimePicker has a limited range defined by the MinDate and MaxDate from the admin form.
i have seen tutorials do this but they only use text/strings which are easy to manipulate. please help... sorry if there's no "try" code here, i just cant do it.
You should save the values the Admin provides in a database.
When the non-admin user visits the form, you will use the values in the database to set the minimum and maximum dates.
Then when the OK or Save button is pressed you validate the values against the values stored in the database.
精彩评论