Jump to content

Recommended Posts

Posted (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 by ribeiro55
Posted

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"

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.