Mis Datetimepicker son D6, D7, D8 ..... D31 y cuando llego a
Case D12.ToString To D13.ToString 'D13= "13:30:00" & D12="12:30:00
Sale vacio
y lo siguiente es como reducir los Case por que solo me admiten 10 CASe????
Código:
Private Sub PHDIFERENCIA2() Dim resta1 As TimeSpan = D7.Value.Subtract(DateTimePicker2.Value) Dim resta2 As TimeSpan = D8.Value.Subtract(DateTimePicker2.Value) Dim resta3 As TimeSpan = D9.Value.Subtract(DateTimePicker2.Value) Dim resta4 As TimeSpan = D10.Value.Subtract(DateTimePicker2.Value) Dim resta5 As TimeSpan = D11.Value.Subtract(DateTimePicker2.Value) Dim resta6 As TimeSpan = D12.Value.Subtract(DateTimePicker2.Value) Dim resta7 As TimeSpan = D13.Value.Subtract(DateTimePicker2.Value) Dim resta8 As TimeSpan = D14.Value.Subtract(DateTimePicker2.Value) Dim resta9 As TimeSpan = D15.Value.Subtract(DateTimePicker2.Value) Dim resta10 As TimeSpan = D16.Value.Subtract(DateTimePicker2.Value) Dim resta11 As TimeSpan = D17.Value.Subtract(DateTimePicker2.Value) Dim resta12 As TimeSpan = D18.Value.Subtract(DateTimePicker2.Value) Dim resta13 As TimeSpan = D19.Value.Subtract(DateTimePicker2.Value) Dim resta14 As TimeSpan = D20.Value.Subtract(DateTimePicker2.Value) Dim resta15 As TimeSpan = D21.Value.Subtract(DateTimePicker2.Value) Dim resta16 As TimeSpan = D22.Value.Subtract(DateTimePicker2.Value) Dim resta17 As TimeSpan = D23.Value.Subtract(DateTimePicker2.Value) Dim resta18 As TimeSpan = D24.Value.Subtract(DateTimePicker2.Value) Dim resta19 As TimeSpan = D25.Value.Subtract(DateTimePicker2.Value) Dim resta20 As TimeSpan = D26.Value.Subtract(DateTimePicker2.Value) Dim resta21 As TimeSpan = D27.Value.Subtract(DateTimePicker2.Value) Dim resta22 As TimeSpan = D28.Value.Subtract(DateTimePicker2.Value) Dim resta23 As TimeSpan = D29.Value.Subtract(DateTimePicker2.Value) Dim resta24 As TimeSpan = D30.Value.Subtract(DateTimePicker2.Value) Select Case DateTimePicker2.ToString Case D6.ToString To D7.ToString L0.Text = CStr(resta1.ToString) T0.Text = CStr(resta1.ToString) Case D7.ToString To D8.ToString L1.Text = CStr(resta2.ToString) t1.Text = CStr(resta2.ToString) Case D8.ToString To D9.ToString L2.Text = CStr(resta3.ToString) t2.Text = CStr(resta3.ToString) Case D9.ToString To D10.ToString L3.Text = CStr(resta4.ToString) T3.Text = CStr(resta4.ToString) Case D10.ToString To D11.ToString L4.Text = CStr(resta5.ToString) T4.Text = CStr(resta5.ToString) Case D11.ToString To D12.ToString L5.Text = CStr(resta6.ToString) T5.Text = CStr(resta6.ToString) Case D12.ToString To D13.ToString L6.Text = CStr(resta7.ToString) T6.Text = CStr(resta7.ToString) Case D13.ToString To D14.ToString L7.Text = CStr(resta8.ToString) T7.Text = CStr(resta8.ToString) Case D14.ToString To D15.ToString L8.Text = CStr(resta9.ToString) T8.Text = CStr(resta9.ToString) Case D15.ToString To D16.ToString L9.Text = CStr(resta10.ToString) T9.Text = CStr(resta10.ToString) Case D16.ToString To D17.ToString L10.Text = CStr(resta11.ToString) T10.Text = CStr(resta11.ToString) Case D17.ToString To D18.ToString L11.Text = CStr(resta12.ToString) T11.Text = CStr(resta12.ToString) Case D31.ToString To D19.ToString L12.Text = CStr(resta13.ToString) T12.Text = CStr(resta13.ToString) Case D19.ToString To D20.ToString L13.Text = CStr(resta14.ToString) T13.Text = CStr(resta14.ToString) Case D20.ToString To D21.ToString L14.Text = CStr(resta15.ToString) T14.Text = CStr(resta15.ToString) Case D21.ToString To D22.ToString L15.Text = CStr(resta16.ToString) T15.Text = CStr(resta16.ToString) Case D22.ToString To D23.ToString L16.Text = CStr(resta17.ToString) T16.Text = CStr(resta17.ToString) Case D23.ToString To D24.ToString L17.Text = CStr(resta18.ToString) T17.Text = CStr(resta18.ToString) Case D24.ToString To D25.ToString L18.Text = CStr(resta19.ToString) T18.Text = CStr(resta19.ToString) Case D25.ToString To D26.ToString L19.Text = CStr(resta20.ToString) T19.Text = CStr(resta20.ToString) Case D26.ToString To D27.ToString L20.Text = CStr(resta21.ToString) T20.Text = CStr(resta21.ToString) Case D27.ToString To D28.ToString L21.Text = CStr(resta22.ToString) T21.Text = CStr(resta22.ToString) Case D28.ToString To D29.ToString L22.Text = CStr(resta23.ToString) T22.Text = CStr(resta23.ToString) Case D29.ToString To D30.ToString L23.Text = CStr(resta24.ToString) T23.Text = CStr(resta24.ToString) End Select
El formato del datetimepicker2 es de la sgte manera:
DateTimePicker2.Format = DateTimePickerFormat.Custom
DateTimePicker2.CustomFormat = "yyyy/MM/dd HH:mm:ss"
DateTimePicker2.Text = Now
Los demas formatos son ( d6, d7, d8 etc etc , todos tienen formato de 24 horas.
D6.Format = DateTimePickerFormat.Custom
D6.Text = Now
D6.Value = Convert.ToDateTime("06:30:00")
_____________________________________________
D7.Format = DateTimePickerFormat.Custom
D7.Text = Now
D7.Value = Convert.ToDateTime("07:30:00")
NOTA: Cuando modifico Datetimepicker2 y cambio un digito, se actualiza de diferencias entre las fechas.
si quieren algun dato adicional avisen.