pruebe este cdigo en pbCalculo.Action:
[code]Sub Action() Handles Action
// ValidateFields
Dim h1 As Integer= Integer.Parse(NthField(txtHinicio.Text, “:”, 1).ToText)
Dim m1 As Integer= Integer.Parse(NthField(txtHinicio.Text, “:”, 2).ToText)
Dim h2 As Integer= Integer.Parse(NthField(txtHFinal.Text, “:”, 1).ToText)
Dim m2 As Integer= Integer.Parse(NthField(txtHFinal.Text, “:”, 2).ToText)
Dim d1 As New Xojo.Core.Date(Xojo.Core.Date.Now.Year, Xojo.Core.Date.Now.Month, Xojo.Core.Date.Now.Day, _
h1, m1, 0, 0, Xojo.Core.TimeZone.Current)
Dim d2 As New Xojo.Core.Date(Xojo.Core.Date.Now.Year, Xojo.Core.Date.Now.Month, Xojo.Core.Date.Now.Day, _
h2, m2, 0, 0, Xojo.Core.TimeZone.Current)
If d1.SecondsFrom1970> d2.SecondsFrom1970 Then
MsgBox “Error, hora final es menor que hora inicial”
Self.Focus= txtHFinal
Return
End If
// calc total tiempo
Dim interval As Xojo.Core.DateInterval= d2- d1
txtTotalTiempo.Text= “”
If interval.Days> 0 Then txtTotalTiempo.AppendText Format(interval.Days, “00”)
If txtTotalTiempo.Text<> “” Then txtTotalTiempo.AppendText “:”
If interval.Hours> 0 Then
txtTotalTiempo.AppendText Format(interval.Hours, “00”)
Else
txtTotalTiempo.AppendText “00”
End If
txtTotalTiempo.AppendText “:”
If interval.Minutes> 0 Then
txtTotalTiempo.AppendText Format(interval.Minutes, “00”)
Else
txtTotalTiempo.AppendText “00”
End If
// calc total grupo
Dim tSecs As Double= (d2.SecondsFrom1970- d1.SecondsFrom1970)* Integer.Parse(txtVoluntarios.Text.ToText)
Dim d3 As New Xojo.Core.Date(d1.SecondsFrom1970+ tSecs, Xojo.Core.TimeZone.Current)
interval= d3- d1
txtTotalGrupo.Text= “”
If interval.Days> 0 Then txtTotalGrupo.AppendText Format(interval.Days, “00”)
If txtTotalGrupo.Text<> “” Then txtTotalGrupo.AppendText “:”
If interval.Hours> 0 Then
txtTotalGrupo.AppendText Format(interval.Hours, “00”)
Else
txtTotalGrupo.AppendText “00”
End If
txtTotalGrupo.AppendText “:”
If interval.Minutes> 0 Then
txtTotalGrupo.AppendText Format(interval.Minutes, “00”)
Else
txtTotalGrupo.AppendText “00”
End If
End Sub
[/code]