vascoc Posted June 8, 2012 at 11:30 AM Report #461379 Posted June 8, 2012 at 11:30 AM (edited) Boas, tenho este panel... http://img692.imageshack.us/img692/4149/dsdsbu.png Eu quero tipo deixar a data de hoje como a data predefinida mas ao mudar a data da data entrada, quando escrevo na textbox numero de noites aparece o datetimepicker da data de saida, eis o erro: http://img201.imageshack.us/img201/3429/dsdsrg.png Dia 9 + 10 seria dia 19 ... Eis a minha programação: Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint Data_EntradaDateTimePicker.MinDate = Today End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If dias_Reserva.Text = "" Then Else Data_SaídaDateTimePicker.Visible = True Data_SaídaDateTimePicker.Value = DateTime.Now.AddDays(Integer.Parse(dias_Reserva.Text)) ' Data_SaídaDateTimePicker.Value = Data_EntradaDateTimePicker.Value = (Integer.Parse(dias_Reserva.Text)) PrecoLabel1.Text = dias_Reserva.Text * Preco_Tipo_QuartoLabel1.Text End If Data_SaídaDateTimePicker.Update() End Sub Acho que o meu erro está nesta linha devido ao "Now" : Data_SaídaDateTimePicker.Value = DateTime.Now.AddDays(Integer.Parse(dias_Reserva.Text)) Edited June 8, 2012 at 12:28 PM by ribeiro55
ribeiro55 Posted June 8, 2012 at 12:33 PM Report #461385 Posted June 8, 2012 at 12:33 PM Terás de aplicar a soma à data de entrada, e não à data actual. Basta-te: Data_SaídaDateTimePicker.Value = Data_EntradaDateTimePicker.Value.AddDays(NumericUpDown1.Value) Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips"
vascoc Posted June 8, 2012 at 03:26 PM Author Report #461461 Posted June 8, 2012 at 03:26 PM Obrigado 🙂
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now